pass a bitmap image from one activity to another

后端 未结 8 1596
清酒与你
清酒与你 2020-12-05 21:57

In my app i am displaying no.of images from gallery from where as soon as I select one image , the image should be sent to the new activity where the selected image will be

8条回答
  •  一整个雨季
    2020-12-05 22:27

    Using this you can pass bitmap to another activity.

    If you are using drawable than convert that drawable to bitmap first.

    Bitmap bitmap = ((BitmapDrawable)d).getBitmap();
    

    For passing that bitmap to another activity using intent use this below code snippet.

    intent.putExtra("Bitmap", bitmap);
    

    And for fetch that bitmap intent in another activity use this

    Bitmap bitmap = (Bitmap)this.getIntent().getParcelableExtra("Bitmap");
    

    Follow this Link for More Detail.

提交回复
热议问题