I have MediaScannerConnectionClient returning me path and uri like below
path=/sdcard uri= content://media/external/images/media/9834 How to find absolute path for the uri ? I tried below and failed and line Log.d(TAG,"after new File");
does not gets executed.
Looks like there is some error in executing line
new File(new URI(uri.getPath())) Any help is highly appreciated. -regards, Manju
File myFile=null; try { myFile=new File(new URI(uri.getPath())); Log.d(TAG,"after new File"); } catch (URISyntaxException e) { e.printStackTrace(); } catch (IllegalArgumentException e){ e.printStackTrace(); } if(myFile!=null && myFile.exists()){ Log.d(TAG,"file exists"); Log.d(TAG,"FilePath: "+myFile.getAbsoluteFile()); }else{ Log.d(TAG,"given file DOESNOT exist");