Created
August 31, 2014 07:01
-
-
Save nein37/3a7d423502404e52e21e to your computer and use it in GitHub Desktop.
ActionBarのメニューにCheckBoxを表示する ref: http://qiita.com/nein37/items/d0c01daf240f3f585092
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
getMenuInflater().inflate(R.menu.menu, menu); | |
return true; | |
} | |
@Override | |
public boolean onOptionsItemSelected(MenuItem item) { | |
int id = item.getItemId(); | |
switch (id){ | |
case R.id.action_radio1: | |
item.setChecked(!item.isChecked()); | |
Toast.makeText(this,"action_radio1",Toast.LENGTH_SHORT).show(); | |
return true; | |
case R.id.action_radio2: | |
item.setChecked(!item.isChecked()); | |
Toast.makeText(this,"action_radio2",Toast.LENGTH_SHORT).show(); | |
return true; | |
} | |
return super.onOptionsItemSelected(item); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment