user click on Options Menu in ActionBarCompat |
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
//return super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case R.id.action_settings:
//match with /res/menu/main.xml
Toast.makeText(this, "Setting", Toast.LENGTH_SHORT).show();
return true;
case R.id.menuid_info:
//match with defined in onCreateOptionsMenu()
Toast.makeText(this, "Info", Toast.LENGTH_SHORT).show();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
Download the files.
Next:
- ActionBarCompat with Share ShareActionProvider
Visit: ActionBarCompat Step-by-step
Description: Handle onOptionsItemSelected() for ActionBarCompat Rating: 4.5 Reviewer: Ringga - ItemReviewed: Handle onOptionsItemSelected() for ActionBarCompat
0 comments:
Post a Comment