开发者

BitmapFactory.decodeFile() returns null, but image renders fine with computer?

开发者 https://www.devze.com 2023-03-06 11:36 出处:网络
I\'m downloading profile pictures from the web and storing them on the sd card.I load the images into a list.For the most part it works.I have about 300 images in my test data and out of those only ab

I'm downloading profile pictures from the web and storing them on the sd card. I load the images into a list. For the most part it works. I have about 300 images in my test data and out of those only about 3 fail to decode when using BitmapFactory.decodeFile. If I copy the image off the phone to a computer the image will render fine.

I'm thinking that these images may be partially corrupt and the computer just ignores the corrupt part and continues rendering. If this is the ca开发者_如何学Cse, is there some way to force the same thing on android?

I'm not really sure why this is failing, so if you think it is some other problem, please let me know.

Thanks!


Do you have any exceptions coming up? These types of decode operations are prone to crashes on Android and you'll get OutOfMemory exceptions which may be why you don't see the image rendered.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号