Android在随身碟中的USB主机模式列表文件 [英] Android in Usb host mode list files in pendrive

查看:198
本文介绍了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 /

这篇关于Android在随身碟中的USB主机模式列表文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆