title: How to show a captured image in an ImageView?
body: <p>I'm trying to display a captured image from a camera intent, but when I call a showPhoto method the image isn't shown in the ImageView. There is no error output to the stack trace so I'm not sure how the issue can be debugged.</p>
  
  <p>Does anyone know what is wrong with the method that its not showing the captured image?</p>
  
  <p>The showPhoto method is as follows:</p>
  
  <pre><code>private void showPhoto(Uri photoUri) {
            String filePath = photoUri.getEncodedPath();
            File imageFile = new File(filePath);
            //File imageFile = new File(photoUri.getPath());
            if (imageFile.exists()){
               Drawable oldDrawable = photoImage.getDrawable(); 
               if (oldDrawable != null) { 
                   ((BitmapDrawable)oldDrawable).getBitmap().recycle();
              }
               Bitmap bitmap = BitmapFactory.decodeFile(imageFile.getAbsolutePath());
               BitmapDrawable drawable = new BitmapDrawable(this.getResources(), bitmap);
               photoImage.setScaleType(ImageView.ScaleType.FIT_CENTER);
               photoImage.setImageDrawable(drawable);
            }       
          }
  </code></pre>
  
  <p>This is the tutorial that I've followed: <a href="http://www.linux.com/learn/tutorials/722038-android-calling-the-camera" rel="nofollow">http://www.linux.com/learn/tutorials/722038-android-calling-the-camera</a></p>
  
  <p>The device I'm testing on is <code>JellyBean 4.1</code> and this is the link to the complete class:</p>
  
  <p><a href="http://hastebin.com/oqokupulol.java" rel="nofollow">http://hastebin.com/oqokupulol.java</a></p>