I'm making an app and at this point i have two different intents carrying images. I' am trying to pass those images in the same activity in imageViews.
Can anyone help? Thanks!!
My code is:
ImageButton btn_insert = (ImageButton)findViewById(R.id.btn_insert);
btn_insert.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(), ViewClothes.class);
i.putExtra(ITEM_IMAGE1, image1);
startActivity(i);
Intent i2 = new Intent(getApplicationContext() , ViewClothes.class);
i2.putExtra(ITEM_IMAGE2 , image2);
startActivity(i2);
}
});
And in the second activity:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_clothes);
Intent i = getIntent();
ImageView image1 = (ImageView)findViewById(R.id.im1);
image1.setImageBitmap(BitmapFactory.decodeFile(i.getStringExtra("image1")));
Intent i2 = getIntent();
ImageView image2 = (ImageView)findViewById(R.id.im2);
image2.setImageBitmap(BitmapFactory.decodeFile(i2.getStringExtra("image2")));
}