On 02/15/2012 08:02 PM, Olof Hedman wrote:
Perhaps it's populating a cache of some kind?
>
That theory doesn't hold.
It would only need to cache the views once, and if you look at what is
actually happening, you will se it binds the_same_view_  over and over
with different list item data.
Nothing is then cached, for a list with 8 items, the information will
be overwritten 16 times before it settles and start to create more
views for the list.

I just happened to have an app with ListView handy, so, here is my log, the number is the position passed into getView, the reference is the convertView:

When the activity is shown for the first time:

02-15 20:17:45.058 I/ScanViewModeList(11347): getView for 0, null
02-15 20:17:45.097 I/ScanViewModeList(11347): getView for 1, null
02-15 20:17:45.160 I/ScanViewModeList(11347): getView for 2, null
02-15 20:17:45.238 I/ScanViewModeList(11347): getView for 0, android.widget.LinearLayout@41877ac8 02-15 20:17:45.238 I/ScanViewModeList(11347): getView for 1, android.widget.LinearLayout@418c4fe8 02-15 20:17:45.238 I/ScanViewModeList(11347): getView for 2, android.widget.LinearLayout@41879f70

After the list is invalidated:

02-15 20:17:47.832 I/ScanViewModeList(11347): getView for 0, android.widget.LinearLayout@41877ac8 02-15 20:17:47.840 I/ScanViewModeList(11347): getView for 1, android.widget.LinearLayout@418c4fe8 02-15 20:17:47.847 I/ScanViewModeList(11347): getView for 2, android.widget.LinearLayout@41879f70

The initial calls to getView with null are, perhaps, unnecessary, but could be legit. In any case, they only happen once, when the listview is initally shown.

As for your log - does your code do anything that could cause listview to change its size, and force a new layout pass? does it unnecessarily call adapter.notifyDataSet{Changed|Invalidated}?

-- Kostya

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to