Tips to speed up Gallery widget in Android Honeycomb?

The difference between using a Gallery and.

The difference between using a Gallery and: loading a ScrollView with ImageViews and scrolling through that is that with the ScrollView scenario, you are pre-loading all of the images, rather than loading them on the fly as you are in the Gallery scenario. If your number of images is small, and you have enough RAM to support all of them, then just use your ScrollView. Beyond that, AFAIK there's not a ton you can do.

You can maintain a bitmap cache where you continue decoding a few images ahead of the current ones in the Gallery and have your Adapter pull from the cache. However, that will only get you so far -- small scrolls will be smooth, but flings past your cache capacity will still result in the decoding being done on demand. That's pretty much unavoidable.

Yeah, I was kind of expecting that answer. The thing is that I cannot be sure how many ImageViews are displayed - it could be anywhere between a few and thousands, so I simply cannot pre-load them all. That's what I did in the initial versions of my application, but it caused OOM errors with some people because they had more images displayed (I'm working on a movie management application, where each image is the cover art for the movie - check out Mizuu Movies on Market for a visual explanation).

I've been thinking that I could perhaps load smaller images during scroll, but I really don't know – Michell Bak Aug 6 at 23:28 You could try creating parallel low resolution renditions of the images and try to decode those ahead of time, using them as placeholders for a lazy-load rather than some static placeholder. Android can stretch the low-resolution images -- this is more or less the effect you get when you zoom into Google Map tiles. You might even try a blur effect so that the scaled-up low-res images don't look so pixelated.

If you can keep your low-resolution file size to ~1K, you might be able to load thousands of those. Note that I'm just brainstorming here, having never tried this technique... :-) – CommonsWare Aug 6 at 23:38 Thanks a lot, CW. I'll probably give lazy loading another go - cheers!

:) – Michell Bak Aug 6 at 23:48.

Gallery does not support the convertView at the moment. You will always receive null for convertView. This is a known issue and there's no ETA for a fix.

Seems what most people want anyways :) – alexanderblom Aug 7 at 7:22 There's no such plan for now. And that's pretty much what Gallery already is. – Romain Guy Aug 7 at 8:04 I see.

Thanks a lot for the explanation, Romain. I hope it will be fixed soon though. – Michell Bak Aug 7 at 15:19 Like I said, no ETA.

The fix won't be part of ICS. – Romain Guy Aug 7 at 7:19.

Turning on Hardware acceleration of your application will have a significant impact (at least had it on my example app). Add android:hardwareAccelerated="true" in the application element of your android manifest developer.android.com/guide/topics/manif....

Hardware acceleration was enabled, but yeah, that does speed up things quite a bit, especially when dealing with large Bitmaps. – Michell Bak Oct 31 at 10:43.

One of the elements which is slowing your Gallery view down is file IO. I'm working on a slideshow app for which I have photos in 1280x720 resolution. The actual file I/O takes 300-400 ms for each file.

Since the File I/O would normally run on the UI thread, this will cause a very visible "hick" in any ongoing photo transition. In order to avoid this, you should: Set a temporary loading drawable that is already cached imageView. SetImageResource(R.drawable.

My_loading_drawable); Create an AsyncTask which loads the drawable in doInBackground(i.e. The File I/O) Updates the imageView in onPostExecute imageView. SetImageDrawable(drawable); PS if the user flicks through multiple pictures, the above approach will typically trigger multiple parallell asynctask which all will be using file I/O.

Not good for performance and may crash your app. You should probably have more structured approach where you only allow one async task at a time.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions