The easiest thing to do is to create a LRU cache for your images,
using SoftReferences. You can find an example of such a cache in my
app Shelves: code.google.com/p/shelves. I use this technique to load
hundreds of book covers.

On Tue, Jan 19, 2010 at 8:53 PM, Nerdrow <[email protected]> wrote:
> I've read in a few posts that there was an bug in the how the Gallery
> widget recycles views, that it was targeted for Eclair, but it looks
> like it's still an issue.  I'm trying to use an extended Gallery (all
> I do is override getChildStaticTransformation).  The Gallery items are
> all simple custom views that simply draw a FastBitmapDrawable, the
> images are pre-scaled, very lean and very basic.  All items are
> 280x320 jpg's, so not huge individually.
>
> As I scroll through the gallery, I get to the same point each time and
> when I call BitmapFactory.decodeFlie(path) I get the "bitmap size
> exceeds VM budget" error.  I've offset the start point in the list and
> it's not a specific image causing the issue, it's when I've decoded a
> certain number of images from disk.  The other posts indicate that
> it's cumulative; multiple bitmaps are being held in memory instead of
> being recycled, and I assumed this was because the Gallery views
> aren't being recycled properly and hanging on to their bitmaps.  I've
> tried paging the image set to 10-20 images at a time, this works but
> after a few pages I get the same exception.
>
> Is there any workaround for this?  Even if it's addressed in an
> update, it's not really viable to wait since all phones aren't going
> to just instantly upgrade once an upgrade is released (judging by how
> slowly 2.0/2.1 is rolling out).  Without a fix or workaround, the
> Gallery seems pretty much useless for images (unless there's only a
> few).
>
> Thanks in advance.
>
> --
> 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
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them
-- 
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