fishzhe / NasaFeed

This is an android app. It read daliy picture feed from nasa's rss feed url. It can set the picture as wallpaper
1 stars 0 forks source link

OutOfMemoryError #2

Closed fishzhe closed 9 years ago

fishzhe commented 9 years ago

Click on refresh button will cause OutOfMemoryError. Caused by loading bitmap.

fishzhe commented 9 years ago

It happens a lot when the app just started. But after a while it will disapper

fishzhe commented 9 years ago

This is because the image from nasa is too big for my device. In order to make it suit every device, I use display manage to get display size. Then take the display size to decode image. Note, the inputstream returned by URLConnection doesn't suppor mark. So need to convert the data into byte array first, then decode the image according to device display size. This solution is validated on my htc device. Next step validate on other device.

fishzhe commented 9 years ago

http://developer.android.com/training/displaying-bitmaps/load-bitmap.html, this link is how to load and display big image.

fishzhe commented 9 years ago

Merge with out of memory 2. And using Picasso lead to no need to worry about this.