This has actually gotten worse. When I finish the app by pressing the back button, then re-launch the app, I am now also getting row views for position 0 from the previous run of the app. So now I have 3 row views floating around for position 0.
Am I doing this all wrong, or what? The key part of this is that when a button is clicked I can easily access the correct row view that contains the button, but I have the problem when I then try to modify a different row view. In my particular case, the problem is only when that other row view is for position 0. On Oct 22, 7:56 pm, Nmix <[email protected]> wrote: > I have a problem withbindView() that has me puzzled. I am using it to > customize each row, including setting icons, coloring the background > and setting up listeners for buttons. It mostly works as expected, but > not quite. > > When I fill the ListView with SimpleCursorAdapter, I get multiple > calls tobindView() for position 0, but only 1 call for the other > rows. The problem is that when all is said and done, I have 2 rows > (LinearLayout) created for position 0. Here is a sample log extract: > > 10-22 23:25:02.834: DEBUG/PAproto(1042): LBV: pos:0 icon:1 > view:android.widget.linearlay...@437e13c0 > 10-22 23:25:02.834: DEBUG/PAproto(1042): LBV: pos:0 icon:1 > view:android.widget.linearlay...@437e13c0 > 10-22 23:25:02.844: DEBUG/PAproto(1042): LBV: pos:0 icon:1 > view:android.widget.linearlay...@437e13c0 > 10-22 23:25:02.853: DEBUG/PAproto(1042): LBV: pos:0 icon:1 > view:android.widget.linearlay...@437e13c0 > 10-22 23:25:02.864: DEBUG/PAproto(1042): LBV: pos:0 icon:1 > view:android.widget.linearlay...@437e13c0 > 10-22 23:25:02.934: DEBUG/PAproto(1042): LBV: pos:0 icon:1 > view:android.widget.linearlay...@437e13c0 > 10-22 23:25:02.997: DEBUG/PAproto(1042): LBV: pos:1 icon:2 > view:android.widget.linearlay...@437e4810 > 10-22 23:25:03.024: DEBUG/PAproto(1042): LBV: pos:2 icon:3 > view:android.widget.linearlay...@437e67a8 > 10-22 23:25:03.054: DEBUG/PAproto(1042): LBV: pos:3 icon:4 > view:android.widget.linearlay...@437e8700 > 10-22 23:25:03.093: DEBUG/PAproto(1042): LBV: pos:4 icon:5 > view:android.widget.linearlay...@437ea660 > 10-22 23:25:03.234: DEBUG/PAproto(1042): LBV: pos:0 icon:1 > view:android.widget.linearlay...@437ecf40 > 10-22 23:25:03.243: DEBUG/PAproto(1042): LBV: pos:0 icon:1 > view:android.widget.linearlay...@437ecf40 > 10-22 23:25:03.243: DEBUG/PAproto(1042): LBV: pos:0 icon:1 > view:android.widget.linearlay...@437ecf40 > 10-22 23:25:03.254: DEBUG/PAproto(1042): LBV: pos:0 icon:1 > view:android.widget.linearlay...@437ecf40 > 10-22 23:25:03.264: DEBUG/PAproto(1042): LBV: pos:0 icon:1 > view:android.widget.linearlay...@437ecf40 > > I use a view holder class to hold the view, position and other data so > that when a button is clicked, I can retrieve the holder with > view.getParent.getTag(). This all works fine. The problem is that > there are two views for position 0, but it's the first one in the > above logcat that seems to be displayed. My code which acts on the > rows when a button is clicked (especially setting background color) > does not reliably hit the position 0 row that is actually displayed. > > I can see what's happening but I am at a loss about what to do about > it. Why are two view created for position 0? Is it something that I > can control? How? If not, how should I deal with it so that the > results when I modify the views are predictable? Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

