0

I searched for hours but didn't find a suitable solution for me. What I want to do: in my ListFragment I use the onListItemClick(...) method to handle the click events. Here, I change the background of the row item. But unfortunately every time the onListItemClick(...) is called, also the getView() from the adapter is called and updates all 8 visible row items. That takes to much time: 0.5 seconds. Because the row layout is pretty complex (2 Images, 8 TextViews). So I want to update only the row which is clicked. I want to use this solution but that has no effect, when the other 7 row items are updated anyways. I already followed these advices to speed the list up, but it's still to slow.

Any help, ideas and thoughts are appreciated. :) Thank you!

[EDIT]

Thanks to CommensWare for giving me some new ideas. What I did now was to check what traceview says. And the result is, that the delay is devided in two parts. The first 300ms of the delay takes the "FastXMLSerialzier.escapeAndAppendString()" with over 22.000 calls. That seems a lot! In the second half, many, maybe all, onMeasure()-methods of the views and layouts are called.

What I tried: I filled every textview with static dummy values in the adapter and excluded the part with loading the images. It changes nothing, traceview shows the same picture. In the second try, I looked at the LinearLayout of my list item and replaced every "wrap_content" I found with "match_parent" - nothing. Still the same.

I am still open for your thoughts and hints. :)

Community
  • 1
  • 1
Camino2007
  • 796
  • 10
  • 17
  • Are you inflating the view everytime getView gets called, or are you reusing the view passed as a parameter to getView? – Marcelo Nov 06 '12 at 11:49
  • I am using the convertView to avoid new inflated views, like it mentioned in the first link in my question. – Camino2007 Nov 06 '12 at 13:23

1 Answers1

0

You have no control over when and how frequently getView() is called.

If it really takes 500ms for you to generate 8 row Views, then there is something wrong with your code. You can use Traceview to determine specifically where you are taking the time, so you can attempt to do something to improve performance (e.g., caching).

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491