@Override public void onCreate(Bundle savedInstanceState) { items = new ArrayList<Task>(); db = new DatabaseInterface(getActivity().getApplicationContext()); items = db.getTasks(); super.onCreate(savedInstanceState); }
@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(); }
private void removeTask(int index) { // Get task to be edited Task task = items.get(index); db.removeTask(task); this.onResume(); }