将位图设置为ImageView



我在此行中的xml-file解码了一个位图:

decodeBase64(parser.getValue(e,KEY_PROJECTIMAGE));

我的布局也有一个imageview。我想将位图放入我的ImageView中。

我无法打电话:projectView.setImageBitmap,但是为什么?

这是我的decodebase64方法:

public static Bitmap decodeBase64(String input) {
     byte[] decodedByte = Base64.decode(input, Base64.DEFAULT);
     return BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length);
}

和getValue方法:

public String getValue(Element item, String str) {
    NodeList n = item.getElementsByTagName(str);
    return this.getElementValue(n.item(0));
}

你能帮我吗?

尝试一下..

imageView pic =(ImageView)findViewById(r.id.profilepicupload);

pic.setimagebitmap(bitmap);

最新更新