Guest User

Untitled

a guest
Sep 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. private void updateCheckedTasks() {
  2. ListView listView = getListView();
  3. int nrOfTasks = listView.getCount();
  4. Log.i("TODO", "This is the number of tasks = "+nrOfTasks); // This prints the 5 items in the list
  5. Task task = null;
  6. for(int i = 0; i < nrOfTasks;i++) {
  7. task = (Task) listView.getItemAtPosition(i); // This doesn't seem to work
  8. Log.i("TODO", "Task = "+task); // This prints that the task is null
  9. if(task.isDone()) listView.setItemChecked(i, true);
  10. }
  11. }
Add Comment
Please, Sign In to add comment