title: ImageView not showing captured photo android
body: <p>I am new in android development. I have been trying to access the camera, capture a photo, and then return to my activity and show it on an ImageView.</p>
  
  <p>Here is the code of my activity (very simple, it just do that)</p>
  
  <pre><code>public class Profile extends Activity  {
  
      private static final int CAMERA_REQUEST = 1337;
      private ImageView imagePhoto;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_profile);
          imagePhoto = (ImageView) findViewById(R.id.imagePhoto);
          ImageView photoButton = (ImageView) this.findViewById(R.id.camera);
          photoButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
                  startActivityForResult(cameraIntent, CAMERA_REQUEST); 
              }
          });
      }
  
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if( requestCode == CAMERA_REQUEST)
          {
              Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
              ImageView image =(ImageView) findViewById(R.id.imagePhoto);
              image.setImageBitmap(thumbnail);
          }
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>What I am doing wrong? I search and try so many codes. When I click in the button, the camera shows up, I take a photo, and then I return to the activity but the thumbnail of the photo is not showing in the ImageView "imagePhoto".</p>
  
  <p>Here is the layout for the imagePhoto:</p>
  
  <pre><code> &lt;ImageView
           android:id="@+id/imagePhoto"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_below="@+id/welcome"
           android:layout_marginRight="50dp"
           android:layout_marginTop="82dp"
           android:layout_toLeftOf="@+id/camera"
           android:src="@drawable/add_photo" /&gt; `/* It has another photo, because I was trying to see if it changes */
  </code></pre>
  
  <p>And this is in my manifest also:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.CAMERA" /&gt;
  &lt;uses-feature android:name="android.hardware.camera" /&gt;
  &lt;uses-feature android:name="android.hardware.camera.autofocus" /&gt;
  </code></pre>
  
  <p>I tried so many codes! Thanks in advance. I'm using a Samsung device.</p>