Android在随身碟中的USB主机模式列表文件
我有索尼片剂,我一个U盘连接到它。
I have sony tablet S and I am connecting a pendrive to it.
我发现code,让我:
I have found code that lets me:
-
- 查找已连接的设备
-Find the connected device
- 查找其接口
- 查找其端点(读,写)
-Find its endpoints (read, write)
- 我很能过打开设备
-I am able to open the device too
我的问题是:
如何列出所有文件和目录的随身碟?
My question is: How do I list all files and directories in the pendrive?
从我已阅读有像
mDeviceConnection.controlTransfer(...)
这允许读取和写入到U盘,但我怎么列出的随身碟的文件和目录?
that allow to read and write to the pendrive but how do I list the files and directories in the pendrive?
我希望能够得到绝对路径包含在随身碟文件,这样我就可以在平板电脑上它们转移到SD卡。
I want to be able to get absolute paths to files contained in the pendrive so I can transfer them to the sd card on the tablet.
感谢
通常安装U盘所在的文件夹中的的/ mnt /
所以,你可以检索的所有文件和文件夹从该文件夹。
Usually mounted pendrive are located in the folder /mnt/
so, you can retrieve all files and folder from that folder.
File storageDir = new File("/mnt/");
if(storageDir.isDirectory()){
String[] dirList = storageDir.list();
//TODO some type of selecton method?
}
它可能发生,该文件夹是对于某些设备,当然不同。 的/ mnt / usb_storage /