title: Android - OnActivityResult Button Click
body: <p>I have a fragment that have 4 buttons that call a camera. And i need to know that button that i have clicked to put the image into that button... </p>
  
  <p>Can some one help me?</p>
  
  <p>Here i call the image button click, check permissions and if all Ok, open the device camera...</p>
  
  <pre><code>img_first_veiculo.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              if (permissionVerification.checkPermissionForCamera()) {
                  if (permissionVerification.checkPermissionForExternalStorage()) {
                      openDeviceCamera();
                  } else {
                      permissionVerification.requestPermissionForExternalStorage();
                  }
              } else {
                  permissionVerification.requestPermissionForCamera();
              }
          }
      });
  </code></pre>
  
  <p>OnActivityResult</p>
  
  <pre><code>@Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
  
      if (resultCode != Activity.RESULT_OK) {
          return;
      }
  
      switch (requestCode) {
  
          case CROP_FROM_CAMERA: {
  
              //TODO Set image here
              Bitmap photo = (Bitmap) data.getExtras().get("data");
              img_first_veiculo.setImageBitmap(photo);
  
              break;
          }
  
          case PermissionVerification.CAMERA_PERMISSION_REQUEST_CODE: {
  
              Intent intent = new Intent("com.android.camera.action.CROP");
  
              intent.setDataAndType(mImageCaptureUri, "image/*");
              intent.putExtra("crop", "true");
              intent.putExtra("outputX", 640);
              intent.putExtra("outputY", 360);
              intent.putExtra("aspectX", 16);
              intent.putExtra("aspectY", 9);
              intent.putExtra("scale", true);
              intent.putExtra("return-data", true);
              startActivityForResult(intent, CROP_FROM_CAMERA);
  
              break;
  
          }
      }
  }
  </code></pre>