@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_sspai: openUrl("http://sspai.com/dfg"); return true; case R.id.menu_checkbox_glare: updateGlareSetting(!item.isChecked()); return true; case R.id.menu_checkbox_shadow: updateShadowSetting(!item.isChecked()); return true; case R.id.menu_about: Intent intent = new Intent(getApplicationContext(), AboutActivity.class); startActivity(intent); return true; default: return super.onOptionsItemSelected(item); } }
void initMenuItem(MenuItem menuItem, BooleanPreference preference) { menuItem.setChecked(preference.get()); }