public void dataReset() { // clear data tasks.clear(); // read database dataReadToList(); // input listview data tasklistAdapter.notifyDataSetChanged(); }
// Context menu public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; TaskData taskSelected = (TaskData) tasklistAdapter.getItem(info.position); String taskTitle = taskSelected.getTitle(); menu.setHeaderTitle(taskTitle); menu.add(Menu.NONE, CONTEXT_EDIT, Menu.NONE, "Edit Task"); menu.add(Menu.NONE, CONTEXT_DELETE, Menu.NONE, "Delete Task"); }