title: android filename from uri is not the same as actual filename
body: <p>I need to get the name and extension of a file that I need to upload. I let the user select the file using an Intent call and get the URI as follows:</p>
  
  <pre><code>public void onActivityResult(int requestCode, int resultCode, Intent data) {
  /* stuff */
  Uri uri = data.getData();
  String filePath = data.getData().getPath();
  Log.d("filePath ",filePath);
  Log.d("URI ", uri.toString());
  String fileName = (new File(filePath)).getName();
  Log.d("fileName ",fileName);
  </code></pre>
  
  <p>but the results are as follows:</p>
  
  <blockquote>
    <p>com.blah.blah D/URI: content://com.android.providers.downloads.documents/document/354<br>
    com.blah.blah D/filePath: /document/354<br>
    com.blah.blah D/fileName: 354</p>
  </blockquote>
  
  <p>the name of the file isn't even 354! its a PDF file (say "Bus e-Ticket.pdf" or "Xender.apk")</p>
  
  <p><code>String fileName = (new File(filePath)).getAbsolutePath();</code>
  also yields the same. 
  how can i get the file name/exstension on disk?</p>