开发者

Android: Usb storage location in 3.0?

开发者 https://www.devze.com 2023-03-05 10:20 出处:网络
My app provides a file browser.I set the root of the file browser to: Environment.getExternalStorageDirectory(); which, on my Acer Iconia Tab, returns \"/mnt/sdcard\".However, many 3.0 devices support

My app provides a file browser. I set the root of the file browser to: Environment.getExternalStorageDirectory(); which, on my Acer Iconia Tab, returns "/mnt/sdcard". However, many 3.0 devices support usb storage. Is there a safe/proper way to get the path to "/mnt"? (to the directory that con开发者_JAVA技巧tains the sdcard and usb storage)


If Environment.getExternalStorageDirectory(); gives /mnt/sdcard/, i was hoping there would be a safe method to get /mnt/usb_storage. There does not appear to be. However, Environment.getExternalStorageDirectory().getParentFile() appears to reliable give the parent directory of /mnt/usb_storage.


If you are talking about devices like the Motorola Xoom that do not have sdcard support then it is safe to use Environment.getExternalStorageDirectory(). The Xoom actually has the sdcard folder structure on the internal storage.

0

精彩评论

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