title: Getting identifier of originating button used to call camera intent on Android
body: <p>If I have multiple buttons on a view to call camera intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE) and a ImageView for the preview of each image and I need to know which button called it in onActivityResult so I know which corresponding preview to use how do I pass an identifying variable? Below is current code that only works with one image.</p>
  
  <p>Picture button:</p>
  
  <pre><code>final ImageButton cameraTakePhotoButton = (ImageButton) photoPromptOption.findViewById(R.id.cameraTakePhotoButton);
  
  cameraTakePhotoButton.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
          Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
          startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
      }
  });
  </code></pre>
  
  <p>onActivityResult:</p>
  
  <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
      if (resultCode == RESULT_OK) {
          if(requestCode == CAMERA_PIC_REQUEST) {
              Bitmap thumbnail = (Bitmap) data.getExtras().get("data");  
              final ImageView questionPhotoResult = (ImageView) findViewById(R.id.questionPhotoResult);
              questionPhotoResult.setImageBitmap(thumbnail);
          } 
      }
  } 
  </code></pre>