Question

I'm displaying an external image in an image view by fist downloading it like this:

bitmap = BitmapFactory.decodeStream((InputStream)new URL(url).getContent());

Then setting this bitmap to the ImageView like this:

imageView.setImageBitmap(bitmap);

This works all good except that one of the images is a PNG and I lose the transparent background when using the BitmapFactory.

Can anyone tell me how I can keep the transparent background?

Was it helpful?

Solution

not sure if this will help, but try following this advice and adding Options to make sure that your image is pulled in as ARGB_8888

http://developer.android.com/reference/android/graphics/BitmapFactory.html#decodeFile(java.lang.String, android.graphics.BitmapFactory.Options)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top