Skip to content Skip to sidebar Skip to footer

How To Send Imageview From One Activity To Other

I have an imageview in listview in first activity, I want to send my imageview into second activity on clicl of listview item. I have tried following code- Convert drawable image i

Solution 1:

You don't need to convert the Bitmap to a byte array. Bitmap is parcelable so you can just use putParcelable(String, Parcelable) to add it to the Bundle.

Edit:

For example:

Bundleextras=newBundle();
extras.putParcelable("Bitmap", bmp);
intent.putExtras(extras);
startActivity(intent);

Then in the second activity:

Bundleextras= getIntent().getExtras();
Bitmapbmp= (Bitmap) extras.getParcelable("Bitmap");

Solution 2:

I thing you pass image ID and set Id in Next Activity Imageview E.g.

GEt ID  ((ImageView) v).getId();
SET ID  imageView.setImageResource(imgId);

Solution 3:

You can convert your ImageView To Bitmap.Try this

Bitmapbitmap= Bitmap.createBitmap(imageView .getMeasuredWidth(),imageView .getMeasuredHeight(), Bitmap.Config.RGB_565);
Canvascanvas=newCanvas(bitmap);
ImageView .draw(canvas);

Post a Comment for "How To Send Imageview From One Activity To Other"