title: IllegalArgumentException: column '_data' does not exist
body: <p>In Nougat, this function is not working.</p>
  
  <pre><code>String path = getRealPathFromURI(this, getIntent().getParcelableExtra(Intent.EXTRA_STREAM));
  </code></pre>
  
  <p><br/></p>
  
  <pre><code>public 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);
          if (cursor == null) return contentUri.getPath();
          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>Crash log:</p>
  
  <pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{class path}: java.lang.IllegalArgumentException: column '_data' does not exist
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2659)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)
     at android.app.ActivityThread.-wrap12(ActivityThread.java)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
     at android.os.Handler.dispatchMessage(Handler.java:102)
     at android.os.Looper.loop(Looper.java:154)
     at android.app.ActivityThread.main(ActivityThread.java:6123)
     at java.lang.reflect.Method.invoke(Method.java)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
  Caused by java.lang.IllegalArgumentException: column '_data' does not exist
     at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:333)
     at android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:87)
     at com.package.SaveImageActivity.getRealPathFromURI()
     at com.package.SaveImageActivity.onCreate()
     at android.app.Activity.performCreate(Activity.java:6672)
     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140)
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2612)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)
     at android.app.ActivityThread.-wrap12(ActivityThread.java)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
     at android.os.Handler.dispatchMessage(Handler.java:102)
     at android.os.Looper.loop(Looper.java:154)
     at android.app.ActivityThread.main(ActivityThread.java:6123)
     at java.lang.reflect.Method.invoke(Method.java)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
  </code></pre>
  
  <p>This function is working properly in devices before Android N. I read the article <a href="https://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat/en" rel="noreferrer">file:// scheme is now not allowed to be attached with Intent on targetSdkVersion 24 (Android Nougat)</a>. But couldn't find any solution. So please help.</p>