How to read/write external USB storage on Android?

别等时光非礼了梦想. 提交于 2019-12-07 07:25:41

问题


I am currently making an app that needs to be able to read from and write to a USB flash drive connected via a USB OTG adapter. Is there an easy way to access this storage via standard Java.io.File APIs? This app is only going to be run on a rooted Motorola Xoom running Android 4.2.2. Any suggestions would be appreciated.


回答1:


USB Drives get mounted to your device just like an SDCard does essentially*.

The mount path usually resides at:

/storage/usb0/

I have not used this on many devices other then my Droid running CyanogenMod, your device may very. You can smiply use a file manager to explore this path. The directories will still exist even if there is no mount path, so you will be able to determine the path.



来源:https://stackoverflow.com/questions/19609114/how-to-read-write-external-usb-storage-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!