title: Android how to get the only uri of Media Store Image?
body: <p>I'm trying to get the uri and after parse into path of MediaStore image.
  I do this to get the uri:</p>
  
  <pre><code>Uri img_uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
  </code></pre>
  
  <p>And after with this function i convert uri in the path:</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);
          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>But the result is that i have the path of the Media storage but with the first element.
  For example: <code>/mnt/sdcard/Pictures/Boat.jpg</code>. But i want only <code>/mnt/sdcard/Pictures/</code>.</p>
  
  <p>Please don't tell me to use join and split because isn't what i want.</p>