public void onEditDialogSave(final CategoryRecord category) { if (updating) { categoryDBAdapter.update(category); } else { categoryDBAdapter.createCategory(category); } refreshCategoryList(); }
@Override public boolean onContextItemSelected(final MenuItem item) { switch (item.getItemId()) { case 1: updating = true; final CategoryEditDialog categoryEditDialog = new CategoryEditDialog(this); categoryEditDialog.buildEditDialog(categoryClicked, this).show(); return true; case 2: final TimerDBAdapter timerDBAdapter = new TimerDBAdapter(this); if (timerDBAdapter.categoryHasTimerRecord(categoryClicked)) { showDeleteWarningDialog(); } else { categoryDBAdapter.delete(categoryClicked.getRowId()); } refreshCategoryList(); return true; default: return super.onContextItemSelected(item); } }