@Override
 public void onDialogPositiveClick(Item newItem, Item oldItem) {
   if (oldItem != null) {
     itemAdapter.remove(oldItem);
   }
   itemAdapter.add(newItem);
 }
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    int itemPosition = ((AdapterContextMenuInfo) item.getMenuInfo()).position;
    Item selectedItem = itemAdapter.getItem(itemPosition);

    switch (item.getItemId()) {
      case R.id.menu_edit:
        return editItem(selectedItem);
      case R.id.menu_delete:
        itemAdapter.remove(selectedItem);
        return true;
      default:
        return super.onContextItemSelected(item);
    }
  }