Android code to convert base64 string to bitmap

后端 未结 3 1249
既然无缘
既然无缘 2020-12-09 19:37

Hi stackoverflow team i have a problem in converting base64 string to bitmap in android. I am using the camera to fetch the image and i am convert the image to base64 string

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-09 20:26

    Write down the Simple method pass the Base64 String and it will return the Bitmap object

    Bitmap Base64ToBitmap(String myImageData)
        {
            byte[] imageAsBytes = Base64.decode(myImageData.getBytes(),Base64.DEFAULT);
            return BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length);
        }
    

提交回复
热议问题