Get the path of a file from other app
<p>In my app I handle sharing of images/videos from other apps.</p>

<p>The problem is that if I want to handle the images from gallery it works great with following:</p>

<pre><code>    Uri fileUri = (Uri) data.getParcelableExtra(Intent.EXTRA_STREAM);


    String[] projection = {MediaStore.MediaColumns.DATA};
    CursorLoader cursorLoader = new CursorLoader(mChatView.returnContext(), fileUri, projection, null, null, null);
    Cursor cursor = cursorLoader.loadInBackground();
    cursor.moveToFirst();
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
    File selectedImage = new File(cursor.getString(column_index));
</code></pre>

<p>I am getting the desired file which I want.</p>

<p>The problem is that is the image is shared via other app (Whatsapp/Fb Messenger) I am getting:</p>

<pre><code>cursor == null
</code></pre>

<p>Example of Whatsapp <strong>URI</strong>: </p>

<pre><code>fileUri = file:///storage/emulated/0/WhatsApp/Media/WhatsApp%20Images/Sent/IMG-20160616-WA0000.jpg
</code></pre>

<p>How can I access the file?</p>

<p>-Tested on Nexus 5 - Android v 6.0.1</p>