Sunday, October 25, 2009

[android-developers] Re: SimpleCursorAdapter.bindView() and Row Views

> What happened when bindView() was called, I checked the view's
> tag for a holder object, and if there was one I left it alone. Since,
> it seems, a row view can be assigned to different positions during the
> filling of the adapter/ListView.

Absolutely. Otherwise, scrolling through 1,000 items in a list would
result in 1,000 rows being created.

> This means I have to update the view
> holder, or create a new one, with the most current position data in
> every call to bindView().

No, you don't -- you just have to write a view holder that does not track
its position.

http://commonsware.com/Android/excerpt.pdf contains an excerpt from one of
my books that demonstrates the technique.

--
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html

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

No comments:

Post a Comment