I have an application that displays thumbnails of all images on the phone. When I quickly scroll through the thumbnails, the application crashes, throwing this exception: Bitmap size exceeds vm budget
I have found one solution was to set the Bitmap.Options.inSampleSize to at least 4 (which makes the images pretty ugly). The other was to set the size of the ImageView for each thumbnail to a small value (such as 64x64 px). But this makes it hard to recognize the images being looked at. Neither of these solutions are ideal, but they minimize the memory being used.
The Gallery application that came with my phone is the ideal way for my application to work. It easily displays all the images on my phone at a reasonable size with great quality. When I scroll through the thumbnails it scrolls very fast compared to my application. I've noticed too that the thumbnails don't load as I scroll through - they seem to be loaded already. I've looked through the source code of the Gallery application and it's hard for an amateur programmer to make sense of what's going on, especially since I could not find documentation.
Anyone know the way Google handled the thumbnails (or have their own solution without the flaws of my solutions)?
Thanks in advance.