Okay, I'll say right up front, there's no good reason why you should be 
doing this. If your PNG has an alpha-channel, what are you doing loading it 
using a config that doesn't support it?

Nonetheless, I was doing this in one of my apps; the PNGs had transparency 
for historical reasons, but I'd been loading them using RGB_565 to save 
memory (the loss in quality wasn't important in this case). And prior to 
Jelly Bean, this worked fine, but in 4.1 it failed silently. It appeared to 
work, but the resultant bitmap was unusable; saving it to SD for debugging 
yielded a 0-length file.

The solution is simple: either remove the alpha-channel from your PNG, or 
load it with a different Config, one that supports transparency. If you can 
spare the RAM, ARGB_8888 is generally the best choice 
(see https://plus.google.com/u/0/111962077049890418486/posts/Ytar76F56y5). 
Or if memory's tight, ARGB_4444 will still work, and uses the same 
16bytes/pixel as RGB_565.

String

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to