简体   繁体   中英

How to display a bitmap image in Android imageview

I am new at Android. Here is my code:

Bitmap bitmap = BitmapFactory.decodeByteArray(nadraData.image, 0, nadraData.image.length); 
    

((ImageView) view.findViewById(R.id.iv_user)).setImageBitmap(bitmap);
    

Log.e(TAG, "onViewCreated: bitmap is "+bitmap );

This worked for me

byte[] decodedString = 
Base64.decode(person_object.getPhoto(),Base64.NO_WRAP);
InputStream inputStream  = new ByteArrayInputStream(decodedString);
Bitmap bitmap  = BitmapFactory.decodeStream(inputStream);
user_image.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