Do bear in mind that in the ListView row items are RECYCLED. This is likely to explain why actions on one row are affecting another. Dig around in Mark's book and you'll find coverage of this.
Do bear in mind that in the ListView row items are RECYCLED. This is likely to explain why actions on one row are affecting another. Dig around in Mark's book and you'll find coverage of this.
If you're using an adapter with the list, you can use getView() on an adapter to add a click handler to each row as it's created/recycled, and make sure the state is managed correctly as the row items are created and recycled. My approach is to store the state in my own data structure, and then use getView() to mirror that in the UI as the user scrolls up and down the ListView. There may be a better solution, but that works for me.
So this is exactly what's happening. I don't know why any of the other answers didn't just state this simple fact. After realizing I was using a convertView and recycling it, it was really obvious.
A minute or two of googling and I know how to resolve this. I looked in Mark's book, Chapter 9, "Getting Fancy With Lists" and his RateList example is detailed there, which explains it pretty clearly. Anyone else having this issue check out that chapter of Beginning Android by Mark Murphy.
– Zach Nov 22 '10 at 23:37 These kinds of quirks in Android do make it a steep learning curve, but once understood we do get the performance benefits of recycling. – Ollie C Nov 23 '10 at 15:12 So that didn't end up working, I went through it and while recycling is definitely the reason behind what I'm seeing, Mark's book doesn't detail how to fix the specific problem I'm having. – Zach Nov 23 '10 at 18:57 What problem remains?
– Ollie C Nov 23 '10 at 20:11 I'm not real sure. The buttons "know" where they are for sure, but they don't store the correct state. I just changed it to a delete button and was done with it.
Too much time wasted. Thanks for the help though, recycling is definitely the underlying issue here. – Zach Nov 23 '10 at 20:22.
I've just had a similar problem. It seemed that it was related to views recycling. But I added Log's everywhere and noticed that the recycling handling was fine.
The problem was RadioButtons handling. I was using: if(answer == DBAdapter. YES){ rbYes.
SetChecked(true); rbNo. SetChecked(false); } else if(answer == DBAdapter. NO){ rbYes.
SetChecked(false); rbNo. SetChecked(true); } else{ rbYes. SetChecked(false); rbNo.
SetChecked(false); } and the correct way of doing it is: if(answer == DBAdapter. YES){ rbYes. SetChecked(true); } else if(answer == DBAdapter.NO){ rbNo.
SetChecked(true); } else{ RadioGroup rg = (RadioGroup)(holder. AnswerView); rg.clearCheck(); }.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.