On Oct 25, 5:50 pm, "Mark Murphy" <[email protected]> wrote:
> > What happened whenbindView() 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.

Understood. It's just that I was surprised that this would happen
while the ListView is being initially filled (also, since in this case
it's short enough to fit within the screen), and there is no obvious
(to me!) reason why a row view would be acted upon this way in this
circumstance.

> > This means I have to update the view
> > holder, or create a new one, with the most current position data in
> > every call tobindView().
>
> No, you don't -- you just have to write a view holder that does not track
> its position.

It may depend on how the holder is used, but it's not entirely
relevant -- my choice of words above wasn't the best. From within the
onClick() for a button on a particular row, I need to find another row
and change it. I needed some way to find it. When I still had the
problem, I kept track of the view I would eventually alter in a class
variable. From there I could pull out the tag and get the data I
needed, including the row's position. What finally messed me up is
that, when presented with a filled tag in the view presented by
bindView(), I *assumed* the position and other data I had put into the
holder earlier was still valid. I should have done a cursor.getPosition
(), and gone on from there to properly refresh the data within the
holder. Because of this mistake, even the logcat output I included
earlier was terribly misleading.

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

I did refer to an earlier tutorial of yours to learn the technique,
though not this update. Thanks for making this available!

> --
> 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 [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