Adsense Ad

Tuesday, 30 January 2018

How to pass / transfer image from One ImageView to another


Image transfer between two activities

First Activity = ProfileActivity

ImageView imgvu1 = (ImageView) findViewbyId(R.id.img1);
imgvu1.buildDrawingCache();
Bitmap bmp=imgvu1.getDrawingCache();
Intent Int= new Intent(ProfileActivity.this,ViewImageActivity.class);
Int.putExtra("BitmapImage",bmp);
startActivity(Int);


Second Activity = ViewImageActivity
ImageView imgvu2 = (ImageView) findViewbyId(R.id.img2);
imageView = (ImageView) findViewById(R.id.viewimage);
if (getIntent().hasExtra("BitmapImage")) {
Bitmap bitmap = (Bitmap) getIntent().getParcelableExtra("BitmapImage");
imgvu2.setImageBitmap(bitmap);
}





----------------------------------------------------------------------------------------------------------------


Image transfer between to ImageView on Single Activity

ImageView imgvu1 = (ImageView) findViewbyId(R.id.img1);
ImageView imgvu2 = (ImageView) findViewbyId(R.id.img2);

Bitmap bmp=imgvu1.getDrawingCache();
imgvu2.setImageBitmap(bmp);

























No comments: