6

I read the Android documentation for USB support at http://developer.android.com/guide/topics/connectivity/usb/host.html and come to know that

Android support the USB host mode, we can read any file from the usb device.

In my case I have a pdf file which is stored in USB pen drive I want to attach the pen drive to my android device and want to read the pdf file data using the phone. Please help me to solve this any demo project or tutorial link to cover this topic. Thanks

user1618714
  • 143
  • 3
  • 6

1 Answers1

-1
  String extStorageDirectory  = context.getExternalCacheDir().getAbsolutePath();

here, it obtains the path as: /mnt/sdcard/Android/data/com.example/cache

now append ur file name with this path. e.g. abc.txt

/mnt/sdcard/Android/data/com.iris.activity/cache/abc.txt

now use File class and get the InputStream from this path and read the file from InputStream.

Parth Doshi
  • 4,200
  • 15
  • 79
  • 129
  • 1
    The question means an external usb device attached to the Android device - it can be any usb device - not necessarily the external storage sdcard that sits inside the device. – AlikElzin-kilaka May 25 '14 at 08:32