title: Unable to fetch file path from uri in Android M
body: <p>I am able to get the files path from URI fetched from notification bar but I could only fetch it from URI received from Android Snackbar.</p>
  
  <p>Current function used to fetch the path:</p>
  
  <p>Note: This works fine for pre-Marshmallow Android versions.</p>
  
  <pre class="lang-java prettyprint-override"><code>private String extractContentUri(Uri uri) {
  
    Cursor cursor = null;
  
    try {
  
      cursor = getContentResolver().query(uri, null, null, null, null);
      Log.d("CHECK", "COUNT" + cursor.getCount());
  
      if (cursor != null &amp;&amp; cursor.moveToFirst()) {
        Log.d("CHECK", "CURSOR !NULL");
        launchedFile = cursor.getString(cursor.getColumnIndexOrThrow("_data"));
        Log.d("CHECK", "==" + launchedFile);
        return launchedFile;
      }
    } catch (IllegalArgumentException e) {
  
    } finally {
      Log.d("CHECK", "{finally} ==" + launchedFile);
      if (cursor != null) {
        cursor.close();
        cursor = null;
      }
  
    }
    return null;
  }
  
  </code></pre>
  
  <p>In android M the URI obtained while accessing the from notification bar and from snackbar are different.</p>
  
  <ul>
  <li>URI from notification bar: <code>content://downloads/all_downloads/1449</code>  </li>
  <li>URI from snackbar: <code>content://downloads/my_downloads/1449</code></li>
  </ul>
  
  <pre class="lang-java prettyprint-override"><code>cursor = getContentResolver().query(uri, null, null, null, null);
  
  </code></pre>
  
  <p>here the cursor<code>.getCount()</code> is always 0 for snackbar.</p>