Skip to main content
Leafcutter
Inspiring
August 24, 2011
Question

Performance advice required - creating images for a scrolling list view on Android

  • August 24, 2011
  • 1 reply
  • 628 views

This is a question about how best to manage thumbnail images in an list view style app written in Actionscript 3 for Android.

I am building an app that uses a list view control to show lists of data.  As each list item appears on screen during a scroll through the list I create a thumbnail image to display in the list item cell. 

Currently I am embedding the jpg thumbnails in actionscript and using mx.core.bitmapasset to get bitmaps on the fly.  On a live device this is unfortunately slowing things down - the smooth scrolling list jerks every time a new cell appears on screen.

There are probably going to be 500+ thumbnails but a list will only ever have about 150 items in it at any one time, of which only about 6 or 7 are onscreen at the same time.  The list view control is one that I have created myself in actionscript but I am pretty sure the thumbnail creation is the cause of the slowdown.  If I take out thumbnails the scrolling is smooth.  If I reuse the same thumbnail across all cells then scrolling is smooth too.  The component reuses cells as they disappear off one end of the list so there isn't much creation of objects going on.

I am running this in debug so it might be possible that in release things are better (maybe?).

Does anyone have any advice on how best to approach this problem of getting jpg assets available quickly?

This topic has been closed for replies.

1 reply

Leafcutter
Inspiring
August 25, 2011

Update: I simply loaded all the jpgs into an array and use that to source the required thumbnails when I display the list.  It takes up more memory but seems to be fine.

I think I am going to have to try and build a FLEX and or a native Android project to compare performance when using a very large number of thumbnails.

Participating Frequently
August 26, 2011

Hi,

I think you can use ContentCache here. See http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/core/ContentCache.html. You need to create an instance of ContentCache and set the contentLoader property of your Bitmap object to this instance. You can control the number of cachedEntries by setting maxCacheEntries. The tutorial by Mihai Corlan http://corlan.org/?p=3106 shows how you can use it. I hope you find it useful.

Thanks,

Sanika