title: How Do I Retrieve A Selected Image Using onActivityResult?
body: <p>I have a button that I want to use to go into the user's image library and they can select an image. I then want to display it in the imageView on the page.</p>
  
  <pre><code> public static final int PICK_IMAGE = 1;
      public void getPhoto(View view){
          Intent intent = new Intent();
          intent.setType("image/*");
          intent.setAction(Intent.ACTION_GET_CONTENT);
  
      startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE);
  }
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      if (requestCode == PICK_IMAGE) {
          ImageView imageView = findViewById(R.id.imageView);
          imageView.setBackground(requestCode);
      }
  }
  </code></pre>
  
  <p>I have been able to successfully select the image, and now I want to use the onActivityResult to set my imageView to the new image.</p>
  
  <p>I thought I would do this by using either the requestCode, resultCode, or data, but I can't quite seem to work out how. Any guidance would be excellent.</p>