I've spent the past 3 hours trying to make this work, so sorry if I forget to post something...
Here's the problem:
(Pretend the ampersands are images and brackets are checkedtextview's checkbox.)
//my list looks like this
& name1Here []
& name2Here []
& name3Here []
& name4Here []
I'll post code tomorrow, but here's what I've been experiencing. - if i use getChildAt() in the listView's onItemClick(), random children check on and off, but after enough clicks all of them uncheck eventually. - if i implement checkedTextView.onClick() in the adapter's getView(), i get nullpointerexceptions for every row in the listview. - if I do anything else that makes sense, upon selecting a row, the checkbox ticks and immediately unticks itself as if i didn't click. But it's still "clicked" because i can get it with listView.getCheckedItemPosition()
I have looked through the code, and i'm not calling toggle() anywhere anymore. The only clickListener i have is in the list.
Basically, this is what it looks like now
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
listConversations.setItemChecked(position, true);
Log.d("<>>>>>>>>>>>>>>>>>>>>>>>>>>>", "listConversations.getCheckedItemPosition() = "+listConversations.getCheckedItemPosition());
listConversations.
OnContactClick(position, id);
}
The number logged is correct. However even with this dumb approach the CheckedTextView's checkable part still ticks/unticks itself on one click. This was my last try for today since i expected the listview to tick off all the others, but no. Either i have way more than one, or none at all.
If you still don't understand the question - what did I mess up to earn this hell and not be able to make the checkmark work like it's supposed to?!?!
Please help. I wasted 3 hours on this ridiculously retarded thing. I am desperate.
lastminuteadd: looks like i'm having the same kind of issue as this guy ListView: setItemChecked only works with standard ArrayAdapter - does NOT work when using customized ArrayAdapter?
Because nobody answered I guess I'll have to...
The trick was to make a Wrapper class implement Checkable. And to make the wrapper class if one was missing...