Cache the thumbnails

In my app (Snap FX) I have two cache levels.

1. In-memory cache (hash-map)
2. Thumbnail record file, much like Thumbs.db on Windows.

1. When requesting a thumbnail of an image, read first from the in-
memory cache.
2. If this fails, read from the thumbnail record file (and put into in-
memory cache).
3. If that fails, read from thumbnail content-provider (and put into
thumbnail record file and into in-memory cache).
4. If that fails, generate a thumbnail from the original image (and
put it into the thumbnail content-provider, into the thumbnail record
file and into in-memory cache).

For fast access to the thumbnail record file, use RandomAccessFile as
a file-based hash-map.



On Feb 15, 11:33 pm, Pankaj <[email protected]> wrote:
> Hi all,
>     I have several images present in different folders in my sdcard. I
> would like to display a list of thumbnails. So what I have done is
> while rendering any row in the list I read the file in an input
> stream, get the byte array, decode it to obtain a bitmap and set it in
> an imageview.
>
> So far so good. But when I scroll the list, the list scrolls in jerks.
> I believe this is because decoding a bitmap from byte array takes some
> time. What I would like to know is that, is there any optimization
> which I can do to improve the performance, or better still is there
> any better method to achieve what I want ?

-- 
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