title: Access the last image in user's gallery and show it in ImageView without selecting
body: <p>I want to show the last image from user's gallery and show it in the ImageView. I used below code but got no success after all.</p>
  <pre><code>private void getLastGalleryImage() {
          // Find the last picture
          String[] projection = new String[]{
                  MediaStore.Images.ImageColumns._ID,
                  MediaStore.Images.ImageColumns.DATA,
                  MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME,
                  MediaStore.Images.ImageColumns.DATE_TAKEN,
                  MediaStore.Images.ImageColumns.MIME_TYPE
          };
  
          final Cursor cursor = this.getContentResolver()
                  .query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null,
                          null, MediaStore.Images.ImageColumns.DATE_TAKEN + &quot; DESC&quot;);
  
          // Put it in the image view
          if (cursor != null) {
              if (cursor.moveToFirst()) {
                  String imageLocation = cursor.getString(1);
                  File imageFile = new File(imageLocation);
                  if (imageFile.exists()) {
                      Bitmap bm = BitmapFactory.decodeFile(imageLocation);
                      galleryImageView.setImageBitmap(bm);
                  }
              }
          }
      }
  </code></pre>
  <p>What I want to achieve is shown in the image below:</p>
  <p><a href="https://i.stack.imgur.com/XgEso.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XgEso.jpg" alt="enter image description here" /></a></p>