I have an activity that contains two imageViews.
I want to pick image separately from gallery for each one.
what should I do in on-Activity-Result to set each image-View background correctly?
thanks.....
Create 2 OnClickListener on your 2 ImageViews. There you set the current ImageView. In onActivityResult you can now set the selected picture from gallery to the current ImageView.
ImageView currentImageView = null; //... imageview1.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ currentImageView = v; // start gallery intent and take picture } }); imageview2.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ currentImageView = v; // start gallery intent and take picture } }); @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { switch(requestCode){ case TAKE_PICTURE_FROM_GALLERY: if (resultCode == RESULT_OK) { uri = //... get Uri currentImageView.setImageUri(uri) } break; } }