title: Android : Fetching image from MediaStore.Images.Media.DATA
body: <p>Sorry if it's a stupid question. Am confused. In my Android App, am trying to get the path to the image chosen by the user from the Gallery. Earlier, I was using MediaStore.Images.ImageColumns.DATA to get the chosen image's path like this:</p>
  
  <pre><code>    cursor = getContentResolver().query(contentURI, projection, null,
              null, null);
      if (cursor == null) { // Source is Dropbox or other similar local filepath
          Log.d(logtag, "getRealPathFromURI : cursor null");
          return contentURI.getPath();
  
      } else {
          cursor.moveToFirst();
          int idx = cursor
                  .getColumnIndex(MediaStore.Images.ImageColumns.DATA);
          String path = cursor.getString(idx);
          cursor.close();
          return path;
      }
  </code></pre>
  
  <p>But this caused issues in certain devices, i.e the cursor returned that there was no such column. So, after referring some Stackoverflow answers, I changed it from MediaStore.Images.ImageColumns.DATA to MediaStore.Images.Media.DATA. Now, this seems to work. What's the difference between MediaStore.Images.ImageColumns.DATA and MediaStore.Images.Media.DATA? And I don't think this has to do with Kitkat version, because both MediaStore.Images.ImageColumns.DATA and MediaStore.Images.Media.DATA existed from API level 1. I tried searching, but couldn't get any useful info. Please help.</p>