How to send the bitmap into bundle

后端 未结 5 1046
北荒
北荒 2021-02-02 16:11

I\'m new to android. I want to pass bitmap into Bundle. But I can\'t find any solution for it. Actually, I\'m confused. I want to display an image in a Dialog fragment. But I do

5条回答
  •  眼角桃花
    2021-02-02 16:26

    No need to convert bitmap to byte array. You can directly put bitmap into bundle. Refer following code to put bitmap into bundle.

    bundle.putParcelable("BitmapImage",bitmapname);
    

    Get bitmap from Bundle by following code

    Bitmap bitmapimage = getIntent().getExtras().getParcelable("BitmapImage");
    

提交回复
热议问题