I have to upload two images (they do not have to be uploaded at the same time) to two ImageView
, each one selected separately from the gallery. I managed to get one of them, but I duplicated the data in the two ImageView
because of the onActivityResult
and I wondered how I could divide the code so that, or appear two onActivityResult
or in it, or call it from another side to call two different methods.
The code I have is the following:
private void openGallery(){
Intent gallery = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivityForResult(gallery, PICK_IMAGE);
}
protected void onActivityResult(int RequestCode, int ResultCode, Intent data) {
//super.onActivityResult(RequestCode, ResultCode, data);
if(ResultCode==RESULT_OK && RequestCode==PICK_IMAGE){
imaginiUri=data.getData();
imagenInicio.setImageURI(imaginiUri);
imagfinUri=data.getData();
imagenFin.setImageURI(imagfinUri);
}
}
Where imagenFin
is ImageView