title: Android: Read any specific image from sd card and display it as bitmap
body: <p>I have retrieved the name of the very first image saved in the media on the sdcard of the emulator.
  Now I want to display the image corresponding to it.. How can I do this ?</p>
  
  <p>Here's the code</p>
  
  <pre><code>import android.app.Activity;
  import android.database.Cursor;
  import android.net.Uri;
  import android.os.Bundle;
  import android.provider.MediaStore;
  import android.util.Log;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  public class ClientActivity extends Activity {
  
  ImageView imageView;
  TextView textView;
  
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_client);
  
  
    imageView = (ImageView) findViewById(R.id.imageView1);
    textView = (TextView) findViewById(R.id.textview1);
    String[] projection = new String[]{
              MediaStore.Images.Media._ID,
              MediaStore.Images.Media.BUCKET_DISPLAY_NAME,
              MediaStore.Images.Media.DATE_TAKEN,
              MediaStore.Images.Media.TITLE,
  
      };
  
      // Get the base URI for the People table in the Contacts content provider.
      Uri images = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
      Log.i("URI", images.toString());
  
              // Make the query.
      Cursor cur = managedQuery(
              MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
              projection, // Which columns to return
              null,         // Which rows to return (all rows)
              null,       // Selection arguments (none)
              MediaStore.Images.Thumbnails.IMAGE_ID          // Ordering
              );
  
      Log.i("ListingImages"," query count="+cur.getCount());
  
      if (cur.moveToFirst()) {
          String bucket;
          String date;
          String name;
  
  
          int bucketColumn = cur.getColumnIndex(
              MediaStore.Images.Media.BUCKET_DISPLAY_NAME);
  
          int dateColumn = cur.getColumnIndex(
              MediaStore.Images.Media.DATE_TAKEN);
  
          int nameColumn = cur.getColumnIndex(
                  MediaStore.Images.Media.TITLE);
  
  
              // Get the field values
              bucket = cur.getString(bucketColumn);
              date = cur.getString(dateColumn);
              name = cur.getString(nameColumn);
  
  
  
              // Do something with the values.
              Log.i("ListingImages", " bucket=" + bucket 
                     + "  name_taken=" + name);
  
      }
  
  
   }
  }
  </code></pre>
  
  <p>Any help will be highly appreciated !</p>