public Bitmap stringtoBitmap(String string) {
//将字符串转换成Bitmap类型
Bitmap bitmap = null;
try {
byte[] bitmapArray;
bitmapArray = Base64.decode(string, Base64.DEFAULT);
bitmap = BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length);
} catch (Exception e) {
e.printStackTrace();
}
return bitmap;
}
Bitmap bitmap = stringtoBitmap("ohfohfosfolfjajppaofpof");
img.setImageBitmap(bitmap);