title: Using ActivityForResult()
body: <p>I am using multiple buttons with OnClickListener() that when clicked startActivityForResult(). In the OnActivityResult() method, there are different actions to be performed. How do I get the right button to go the the right result?</p>
  
  <pre><code>    @Override
  public void onClick(View v) {
      // TODO Auto-generated method stub
      switch (v.getId()) {
  case R.id.camImgButton:
          i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
          startActivityForResult(i, picture);
          break;
  
      case R.id.galImgButton:
          i = new Intent();
          i.setType("image/*");
          i.setAction(Intent.ACTION_GET_CONTENT);
          i.addCategory(Intent.CATEGORY_OPENABLE);
          startActivityForResult(i, REQUEST_CODE);
          break;
      case R.id.txtButton:
  
      }
  }
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      // TODO Auto-generated method stub
      super.onActivityResult(requestCode, resultCode, data);
      switch (       ) {
      case        :
  
      if (resultCode == RESULT_OK) {
          // We need to recyle unused bitmaps
          if (bmp != null) {
              bmp.recycle();
          }
          Bundle extras = data.getExtras();
          bmp = (Bitmap) extras.get("data");
          display.setImageBitmap(bmp);
          break;
          case        :
  
          InputStream stream = null;
      if (requestCode == REQUEST_CODE &amp;&amp; resultCode == Activity.RESULT_OK)
          try {
          // We need to recyle unused bitmaps
          if (bmp != null) {
          bmp.recycle();
          }
      stream = getContentResolver().openInputStream(data.getData());
      bmp = BitmapFactory.decodeStream(stream);
  
                      display.setImageBitmap(bmp);
                  } catch (FileNotFoundException e) {
                      e.printStackTrace();
                  } finally {
                      if (stream != null)
                          try {
                              stream.close();
                          } catch (IOException e) {
                              e.printStackTrace();
                          }
                  }
          }
      }
  </code></pre>