title: pick gallery image and convert to bitmap?
body: <p>I am trying to pick an image from the gallery, convert it to a <code>Bitmap</code>, and display it in an <code>ImageView</code>.</p>
  
  <p>the below code is used to pick image from the gallery</p>
  
  <pre><code>    Intent pickPhoto = new Intent(
              Intent.ACTION_PICK,
              android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
      startActivityForResult(pickPhoto, 1);`
  </code></pre>
  
  <p>In <code>onActivityResult</code> I am converting it into a <code>Bitmap</code> and displaying it in the <code>ImageView</code></p>
  
  <pre><code>protected void onActivityResult(int requestCode, int resultCode,
          Intent imageReturnedIntent) {
      super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
      switch (requestCode) {
      case 1:
          if (resultCode == RESULT_OK) {
              Uri selectedImage = imageReturnedIntent.getData();
              BitmapFactory.Options options = new BitmapFactory.Options();
              options.inSampleSize = 4;//returning null for below statement
              bitmap = BitmapFactory.decodeFile(selectedImage.toString(), options);
              productItemImage.setImageBitmap(bitmap);
          }
          break;
      }
  }
  </code></pre>
  
  <p>The value in the selected image Uri is returned as "content://media/external/images/media/3647"</p>
  
  <p><code>productItemImage</code> is my <code>ImageView</code> to which I am displaying the <code>Bitmap</code>. There is no error but the bitmap is returning null.</p>
  
  <p>Please Help</p>