Hi,

I have to provide an image-galary in my app. I decided to work with a
GridView and provide the data thru an adapter. At the beginning I had many
problems with out-of-memory exceptions and the app was very unstable. At the
weekend I read alot on Stackoverflow and on android-developer. I followed
the steps mentioned by Google to avoid this problem:
http://developer.android.com/training/displaying-bitmaps/load-bitmap.html
http://developer.android.com/training/displaying-bitmaps/process-bitmap.html
http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html

Conclusion: Now I load downsampled images over an AsyncTask into an async
BitmapDrawable, that itself is provided thru the adapter. Once a bitmap is
loaded, it is puttet into the memory-cache (1/8 of available memory) and is
taken from there, if needed again.

these steps made my galery much more stable and perfomat. but at a listcount
of 15+ and very fast scrolling thru the list, the galery stills crashes with
oom-ex.

the imagesize of the displayed bitmaps (downsampled) is between 480x640 &
600x800.

on this side google recommends to build a disk-lru-cache to save memory,
when using gridview & adapter to display alot of images.
http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html

Here are two samples of disk-lru-cashe (by Google):
http://code.google.com/p/android/issues/attachmentText?id=29400&aid=294000000000&name=DiskLruCache.java&token=Rstp2OFViiWaUGS68yFfFgMQDEk%3A1335231242264
http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/util/DiskLruCache.java?r=fcd13b09ef50f290dc0681ebec74fbdfcac969a5

But I don't have anough skill to translate this code into c#. 
What can I do?
Is the disk-lru-cache the way to go? Do I have to translate it into c# or
can one of these java-classes be easily bound into a mono-project? (I tried
this yesterday, but I get compiler-errors). Are there other ways of
optimation?

questions over questions :-)
hope someone has a hint for me!

regards
Lee



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Disk-LRU-Cache-tp5712209.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to