如何检测,如果该设备具有一个SD卡?设备、SD

2023-09-06 04:02:27 作者:你女友@

我预见我的应用程序将需要一个SD卡存储设备的存在。 我如何查询设备的存储选项清单?

I forsee that my application will require the existence of a sdcard storage device. How do I query the device for a manifest of storage options ?

推荐答案

您可以使用 getExternalStorageState()。该开发者网站(这里链接)具有推荐的方式很短的片段来检查外接SD卡的presence,以及是否可以写入。

You can use getExternalStorageState(). The developer site (linked here) has a short snippet of the recommended way to check for the presence of the external SD card, and whether or not you can write to it.