Displaying an Image in an activity using URI
<p>I'm writing an application that uses Intent(MediaStore.ACTION_IMAGE_CAPTURE) to capture and image. On the process of capturing the image, I noted the output of the image's URI. Right after finishing the camera activity, I wish to display the image using this specific URI.</p>

<p>The method I used to capture images is:</p>

<pre><code>    private void saveFullImage() {
  Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  File file = new File(Environment.getExternalStorageDirectory(), 
                       "test.jpg");
  outputFileUri = Uri.fromFile(file); 
  intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
  startActivityForResult(intent, TAKE_PICTURE);
}
</code></pre>

<p>Which is a method taken from Reto Meier's book Professional  Android 2  Application Development.</p>

<p>The method works fine, and I assume that the URI of the picture I just took is stored in the outputFileUri variable. Then at this point of the code is where I want to display the picture:</p>

<pre><code>    @Override
protected void onActivityResult(int requestCode, 
                                int resultCode, Intent data) {
  if (requestCode == TAKE_PICTURE) {

      //I want to display the picture I just took here
      //using the URI

  }
}
</code></pre>

<p>I'm not sure how to do it.</p>

<p>I tried creating a new layout object and a new ImageView object using the method setImageURI(outputFileUri). My main layout (xml) did not have a ImageView object. But even when I set the contentView to the new layout with the ImageView attached to it, it doesn't display anything. I tried creating a Bitmap object from the URI and set it to the ImageView, but I get an unexpected error and forced exit.</p>

<p>I have seen examples from here <a href="http://stackoverflow.com/questions/2227209/how-to-get-the-images-from-device-in-android-java-application/2229154#2229154">here</a> which creates a Bitmap from URI, but it's not displaying it?</p>

<p>My question is just how to display an image in the middle of a running activity? Do I need to get the File Path (like <a href="http://stackoverflow.com/questions/3401579/android-get-filename-and-path-from-uri-from-mediastore">this</a>) in order to display it? If I make a Bitmap out of the URI, how do I display the Bitmap?</p>

<p>I'm just probably missing something simple...so any help would be a greatly appreciated!</p>

<p>Also additional question for thought: If I were to take multiple pictures, would you recommend me to use the SimpleCursorAdapter instead?</p>

<p>Thanks!</p>
