Android in pendrive usb host mode list files

I have a sony tablet S and am connecting it to myself.

I found code that allows me:

  • -Recognize the connected device

  • -View your interfaces

  • -See your endpoints (read, write)

  • - I can also open the device

My question is: How can I list all files and directories in pendrive?

From what I read, there are methods like

mDeviceConnection.controlTransfer(...)

which allow you to read and write to pendrive, but how can I list files and directories in pendrive?

I want to get the absolute paths to the files contained in pendrive so that I can transfer them to the SD card on the tablet.

thank

+5
source share
1 answer

pendrive /mnt/, .

File storageDir = new File("/mnt/");
if(storageDir.isDirectory()){
    String[] dirList = storageDir.list();
    //TODO some type of selecton method?
}

, , . /mnt/usb_storage/

0

All Articles