0

I'm caching the views in an array, and returning them in the getView. I'm also returning the array.length in the getCount.

the problem is, only on android 4.2, the adapter is giving me a position higher than my array.length.

I did a workaround (using position % array.length) but it seems like the view is draw twice.

Anyone having the same problem?

Gugadin
  • 21
  • 2
  • 2
    It's very difficult to understand a problem without seeing the relevant code, also you shouldn't keep references to the ListView rows otherwise you are fighting the way ListViews recycle the layouts and bad things happen. I think this is mentioned in [World of ListView](http://www.google.com/events/io/2010/sessions/world-of-listview-android.html). – Sam Mar 05 '13 at 16:52
  • yeah, but creating the view on getView makes my app really slow, almost freezes it (even using convertview). I will investigate further. – Gugadin Mar 11 '13 at 11:54
  • You can cache the data, just not the Views themselves since the ListView already caches and recycles those. Look into the various versions of LazyAdapter to see how they fetch the data in AsyncTasks while using the speed boosts from reusing Views (`convertView`), ViewHolders, etc. – Sam Mar 11 '13 at 14:37
  • I dont understand why it happens only on 4.2. – Gugadin Apr 12 '13 at 15:04

0 Answers0