Activityにメニューを追加
1134 ワード
//
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Activity,
//R.menu.main,
//menu, , Menu
getMenuInflater().inflate(R.menu.main, menu);
return true;// ,false,
}
// ,
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.add_item:
Toast.makeText(FirstActivity.this, "This is add menu", Toast.LENGTH_LONG).show();
break;
case R.id.removee_item:
Toast.makeText(FirstActivity.this, "This is remove menu", Toast.LENGTH_LONG).show();
default:
break;
}
return true;
}