I am saving byteArray of an image in MySQL Database, and Retrieving from Databses then coverting string to byteArray then byteArray to get Bitmap. But Bitmap is Null i have tried a lot of codes but still NULL. Saving an Image
private String imageviewtobyte(ImageView view){
Bitmap bitmap=((BitmapDrawable) view.getDrawable()).getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
byteArray = stream.toByteArray();
ConvertImage = Base64.encodeToString(byteArray, Base64.DEFAULT);
return ConvertImage;
}
Getting an Image
imgData=result;
byte[] byteArray = Base64.decode(result, Base64.DEFAULT);
Bitmap bMap = null;
bMap = BitmapFactory.decodeByteArray(byteArray,0,byteArray.length);
testimg.setImageBitmap(bMap);
Looking for experts to getting exact error with solution.