Problem with multiple image selection in android
<p>I have a problem in selecting image from image gallery. In my view there are two Buttons and two EditTexts. On clicking each button I want to choose and image from gallery and the path of the image needs to copied into the respective EditText. In my code image selection is working but the path is entered into only one EditText for both buttons. Please help me.</p>

<p>My Code:</p>

<pre><code>private String imageType;

public void browsePositionImage(View button)
{
    imageType = "POSITION";
    startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI), SELECT_IMAGE );
}

public void browseObjectImage(View button)
{
    imageType = "OBJECT";
    startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI), SELECT_IMAGE );
}



@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SELECT_IMAGE)
if (resultCode == Activity.RESULT_OK) {
    Uri selectedImage = data.getData();

   if(imageType == "POSITION")
   {
     final EditText txtPImage = (EditText) findViewById(R.id.EditTextPositionImage);
     txtPImage.setText(getRealPathFromURI(selectedImage));
    }
    else
   {
      final EditText txtPImage = (EditText) findViewById(R.id.EditTextObjectImage);
      txtPImage.setText(getRealPathFromURI(selectedImage));
   }
   } 
}
</code></pre>
