Skip to content

Instantly share code, notes, and snippets.

@martinmidtsund
Created April 3, 2012 17:30
Show Gist options
  • Save martinmidtsund/2293914 to your computer and use it in GitHub Desktop.
Save martinmidtsund/2293914 to your computer and use it in GitHub Desktop.
private void updateCheckedTasks() {
ListView listView = getListView();
int nrOfTasks = listView.getCount();
Log.i("TODO", "This is the number of tasks = "+nrOfTasks); // This prints the 5 items in the list
Task task = null;
for(int i = 0; i < nrOfTasks;i++) {
task = (Task) listView.getItemAtPosition(i); // This doesn't seem to work
Log.i("TODO", "Task = "+task); // This prints that the task is null
if(task.isDone()) listView.setItemChecked(i, true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment