简体   繁体   中英

Set Bitmap to ImageView

I have a Bitmap decoded from XML-File in this line:

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

I have also a ImageView in my Layout. I want to put the Bitmap in my ImageView.

I can't call: projectView.setImageBitmap but why?

Here is my decodeBase64 method:

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

and the getValue method:

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

Can you help me?

try with this..

ImageView pic = (ImageView) findViewById(R.id.profilepicUpload);

pic.setImageBitmap(bitmap);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM