I have a ListView that utilizes a CheckedTextView and a clear all button that has the following code:
btnClearAll.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
int listsize = songsList.size();
filelv = (ListView)getView().findViewById(R.id.FileList);
checkedCount = 0;
for (int i=0; i<listsize-1; i++) {
// if(currentPlayList.get(i).equals ("Checked")){
songsList.get(i).get("songCheckedStatus").equals("Not Checked");
filelv.setItemChecked(i, false);
}
}
});
When the code executes, each array “songsList” value is set to “Not Checked” correctly, so I know that the button is working. However, the CheckedTextView items are not “unticking”.
Where am I going wrong?
olution:
As mentioned above, I just set up a global variable and passed whether I wanted to Select All or Clear All to it. Then I just called my function for populating the ListView. As the ListView is built, it checks the variable in a simple “if” statement, and adds whether to check or uncheck. The cursor adapter then does the check/uncheck as it reruns.
And this from my data grabber for the ListView.
and finally, this section from the cursoradapter getview