Example #1
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   items = new ArrayList<Task>();
   db = new DatabaseInterface(getActivity().getApplicationContext());
   items = db.getTasks();
   super.onCreate(savedInstanceState);
 }
Example #2
0
  @Override
  public void onResume() {
    System.out.println("**List Fragment onResume() called**");
    items.clear();
    items.addAll(db.getTasks());

    // Show guiding layout when list is empty
    if (items.isEmpty()) {
      layout_guide.setVisibility(View.VISIBLE);
    }

    adapter.notifyDataSetChanged();
    super.onResume();
  }
Example #3
0
 private void removeTask(int index) {
   // Get task to be edited
   Task task = items.get(index);
   db.removeTask(task);
   this.onResume();
 }