title: get real path from URI of type data.getData() file:///storage/emulated/0/LenovoReaper/did
body: <p>My application going to <code>ANR</code> when I choose file and try to get its real path. my </p>
  
  <pre><code> public static String getRealPathFromUri(Context context, Uri contentUri) {
          Cursor cursor = null;
          try {
              String[] proj = {MediaStore.Images.Media.DATA};
              cursor = context.getContentResolver().query(contentUri, proj, null, null, null);
              int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
              cursor.moveToFirst();
              return cursor.getString(column_index);
          } finally {
              if (cursor != null) {
                  cursor.close();
              }
          }
      }
  </code></pre>
  
  <p>but same thing works fine if I choose any media file like image.</p>
  
  <p>Works fine for <code>data.getData() = content://media/external/images/media/22555 real path</code></p>
  
  <p>real path is <code>/storage/emulated/0/DCIM/20150406_210053.jpg</code></p>
  
  <p>for non media file it goes to <code>ANR</code> </p>
  
  <pre><code>data.getData() file:///storage/emulated/0/LenovoReaper/did
  </code></pre>
  
  <p>nothing is returned and Application goes to <code>ANR</code>. Could some one suggest how to get real path of such <code>URI</code> or should I just remove <code>file://</code> from the <code>data.getData()</code></p>