title: How to get absolute file path for media uri
body: <p>I have MediaScannerConnectionClient returning me path and uri like below</p>
  
  <pre><code>path=/sdcard
  uri= content://media/external/images/media/9834
  </code></pre>
  
  <p>How to find absolute path for the uri ? I tried below and failed and line
  Log.d(TAG,"after new File");<br>
  does not gets executed.</p>
  
  <p>Looks like there is some error in executing line </p>
  
  <pre><code>new File(new URI(uri.getPath())) 
  </code></pre>
  
  <p>Any help is highly appreciated.
  -regards,
  Manju</p>
  
  <pre><code>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 &amp;&amp; myFile.exists()){
      Log.d(TAG,"file exists");
      Log.d(TAG,"FilePath: "+myFile.getAbsoluteFile());
  }else{
      Log.d(TAG,"given file DOESNOT exist");
  </code></pre>