我正在构建一个Android应用程序。我有一个Base64编码的字符串。我需要两个答案: - 如何将编码的字符串转换为图像 - 如何将其设置为图像按钮的图像资源
答案 0 :(得分:0)
String base="****Base64 string values of some image******”;
byte[] imageAsBytes = Base64.decode(base.getBytes(), Base64.DEFAULT);
ImageButton image = (ImageButton )this.findViewById(R.id.imagebutton);
image.setImageBitmap(
BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length)
);