@Override
  public void onCreateContextMenu(
      final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    categoryClicked =
        (CategoryRecord)
            getListView().getItemAtPosition(((AdapterContextMenuInfo) menuInfo).position);

    menu.setHeaderTitle(categoryClicked.getCategoryName());

    menu.add(0, 1, 0, R.string.category_menu_edit);
    menu.add(0, 2, 0, R.string.category_menu_del);
  }
 @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);
   }
 }