title: How to get Path of image which is shared from whatsapp in android
body: <p>I'm not getting Path from image from uri that I receive from whatsApp.</p>
  
  <p>Uri comes like this: content://com.whatsapp.provider.media/item/66381</p>
  
  <p>Image from any other apps is coming fine in my app (like facebook, twitter etc.) But its not working fine with the whatsapp.</p>
  
  <p>Can anyone help me here to get the image path from it.
  App getting crashed in this case.</p>
  
  <p>Method which I've used to get the path of the image:</p>
  
  <pre><code>private String getRealPathFromURI(Uri contentUri) {
      String result;
      String[] projection = { MediaStore.Images.Media.DATA };
      CursorLoader loader = new CursorLoader(mContext, contentUri, projection, null, null, null);
      Cursor cursor = loader.loadInBackground();
      if(cursor == null){
          result = contentUri.getPath();
      }else {
          int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
          cursor.moveToFirst();
          result = cursor.getString(column_index);
          cursor.close();
      }
      return result;
  }
  </code></pre>