I'm trying to find an effective way of working with media thumbnails returned from the MediaStore
. Actually, there are two kinds of thumbnails: MICRO_KIND
which is square and has 96x96 size independent of the device or platform; and MINI_KIND
which is around 512x384 for a landscape image, and around 288x512 for a portrait image, also device- and platform-independent. Now, I'm using all the best practices for asynchronous Bitmap
loading, recycling and caching, and actually my application works just fine when I use MICRO_KIND
. Anyway, this is not what I want, especially for tablets, where such small images look poor. I've tried using MINI_KIND
, but it exceeds memory limit pretty quickly, nevermind the implementation. Another trouble is that portrait images have portrait thumbnails, and I need them all to be rectangle landscape. I've tried cropping and resizing Bitmaps
keeping the aspect ratio, but it gives me even more headache, since for every operation with a Bitmap
a copy is created and nevermind I'm always using the Bitmap.recycle()
method, OutOfMemory
kills me over and over again. I'm looking for an elegant and memory efficient way of creating thumbnails of strictly specified size and orientation, using those queried from MediaStore
. Would highly appreciate any help and references.
Asked
Active
Viewed 367 times
0

Egor
- 39,695
- 10
- 113
- 130
-
You may have memory leak, check your code with [MAT](http://www.eclipse.org/mat/). – Shrikant Ballal Sep 28 '12 at 10:14
1 Answers
2
As you are saying, you have used everything from cropping to recycling, now try with WeakReferences
as well.
If this also does not help, then you may have memory leak in your code.
Please see my answer on same issue: bitmap size exceeds Vm budget error android
Its a generic answer, try with all methods that I have mentioned. One of them should work for you :)
Thank you.

Community
- 1
- 1

Shrikant Ballal
- 7,067
- 7
- 41
- 61