java - how to get path of USB connected to a device in android? -


i want find general code (java on android platform) give me path of mounted usb enviroment.getexternalstorage().getpath used sdcard only?

for ex: when want image sd card use path file f = new file("/sdcard/photo.jpg");

so question how usb connected mobile?

tried code works specific device not all..

  if (clef != null) {         file directory = new file("storage/usb");         if (directory.canread()) {              images = new arraylist<>();             string[] imageextensions = {"jpg", "jpeg"};             iterator iterateimages = fileutils.iteratefiles(directory, imageextensions, true);             while (iterateimages.hasnext()) {                 file theimage = (file) iterateimages.next();                 if (!theimage.getname().startswith(".", 0)) {                     images.add(theimage.tostring());                 }              } 


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -