@Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);

    boolean ret = false;

    switch (item.getItemId()) {
      case R.id.addBanquet:
        ret = true;
        break;
    }

    return ret;
  }
Пример #2
0
 @Override
 public boolean onContextItemSelected(MenuItem item) {
   AdapterView.AdapterContextMenuInfo info =
       (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
   switch (item.getItemId()) {
     case R.id.shopping_delete:
       // return item name then delete from based on name
       String itemName = favItems.get(info.position).getName();
       db.execSQL("DELETE FROM favRecipes WHERE name='" + itemName + "'");
       favItems.remove(info.position);
       adapter.notifyDataSetChanged();
       break;
     default:
       super.onOptionsItemSelected(item);
       break;
   }
   return true;
 }
Пример #3
0
 // 添加退出
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   if (item.getItemId() == R.id.action_exit) this.finish();
   return true;
 }