开发者

How figure out how many sd cards android device carries

I found that using Environment object isn't reliable;e to determinate SD card. Actually it works, however sometimes tells like as no SD card, so I use just direct mount as /sdcard and it wor开发者_开发技巧ks. Now I realized that a device may have several SD cards. My device report it as external-sdcard, so I can access this card as /external-sdcard or /sdcard/external-sdcard. Now question, how to figure out type of a particular mount? I can traverse directory, but File object doesn't have any attribute telling me I am SD card. I remember regular Java provides FileSystem objects which I can use to inspect particular files and this object can tell me if a File object is simple file, or it is drive, or it is external drive. Is something like that available for Android?


AFAIK, the currently documented API only supports one SD card (actually external storage). You can use Environment.getExternalStorageDirectory() to get the directory, and Enviroment.getExternalStorageState() to check if it is mounted.

Anything besides that seems to be (currently) unsupported. Bearing that in mind, you could parse /proc/mounts to find out what file systems are mounted where.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜