List of usage examples for android.view MenuItem getItemId
public int getItemId();
From source file:com.simplechatclient.android.ProfileRegisterFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.profile_register_button_register: register_nick();/*from www . j a va 2s. c o m*/ break; } return super.onOptionsItemSelected(item); }
From source file:im.afterclass.android.activity.InvitePickActivity.java
public boolean onOptionsItemSelected(MenuItem item) { //Intent intent; switch (item.getItemId()) { case android.R.id.home: //intent = new Intent(InvitePickActivity.this,CreateActivity.class); //startActivity(intent); this.finish(); overridePendingTransition(0, R.anim.zoom_out); return true; default:// w w w .j ava2 s .c o m return super.onOptionsItemSelected(item); } }
From source file:com.easibeacon.examples.shop.MainActivity.java
@Override public boolean onMenuItemSelected(int featureId, MenuItem item) { if (item.getItemId() == R.id.mnuScan) { scanBeacons();//from ww w .jav a 2 s.c o m } else if (item.getItemId() == R.id.profile) { Intent profile = new Intent(this, AddTrackActivity.class); startActivity(profile); } // TODO Auto-generated method stub return super.onMenuItemSelected(featureId, item); }
From source file:net.olejon.spotcommander.DonateActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { finish();//from www.ja v a2 s. co m overridePendingTransition(0, R.anim.donate_finish); return true; } case R.id.donate_menu_reset: { resetDonations(); return true; } default: { return super.onOptionsItemSelected(item); } } }
From source file:com.andrewshu.android.reddit.mail.InboxActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.compose_message_menu_id: showDialog(Constants.DIALOG_COMPOSE); break;/*from ww w. j a va 2s. c o m*/ case R.id.refresh_menu_id: String whichInbox = whichInboxes[getTabHost().getCurrentTab()]; InboxListActivity inboxListActivity = (InboxListActivity) getLocalActivityManager() .getActivity(whichInbox); if (inboxListActivity != null) inboxListActivity.refresh(); break; case android.R.id.home: Common.goHome(this); break; } return true; }
From source file:com.jonbanjo.cupsprint.CertificateActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.about: Intent intent = new Intent(this, AboutActivity.class); intent.putExtra("printer", ""); startActivity(intent);//from www. j a va 2 s . c o m break; } return super.onContextItemSelected(item); }
From source file:com.netatmo.weatherstation.sample.LoginActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent browserIntent = new Intent(); browserIntent.setAction(Intent.ACTION_VIEW); switch (item.getItemId()) { case R.id.action_forgot_password: browserIntent.setData(Uri.parse("https://auth.netatmo.com/access/lostpassword")); startActivity(browserIntent);//from w w w .j a v a 2 s . c o m return true; case R.id.action_create_account: browserIntent.setData(Uri.parse("https://auth.netatmo.com/access/signup")); startActivity(browserIntent); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.octade.droid.ilesansfil.IleSansFil.java
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_LOCATION: if (item.isChecked() == false) { item.setChecked(true);/* w w w . j a v a 2s .c o m*/ item.setTitle(getResources().getString(R.string.menuGpsOn)); mainApp.getMapView().setLocationDetection(true); } else { item.setChecked(false); item.setTitle(getResources().getString(R.string.menuGpsOff)); mainApp.getMapView().setLocationDetection(false); } return true; case MENU_SETTINGS: return true; case MENU_ABOUT: about(); return true; case MENU_TOGGLE_PIN: if (mainApp.getMapView().togglePins() == true) { item.setChecked(true); item.setTitle(getResources().getString(R.string.menuPinOn)); } else { item.setChecked(false); item.setTitle(getResources().getString(R.string.menuPinOff)); } return true; } return false; }
From source file:com.privacity.MenuActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { comm.borrarBaseDeDatos(); //The tokens from the database are erased. this.finish(); //The app is closed return true; }/* w w w . j ava2s. co m*/ return super.onOptionsItemSelected(item); }
From source file:com.sudhirkhanger.app.popularmoviesstageone.TitlesFragment.java
/** * User makes choice about sorting/*from ww w . ja v a 2s . co m*/ * There are two possibilities * First on basis of popularity * Second on basis of average rating * * @param item * @return */ @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.popularity: mEditor.putString(SHARED_KEY_SORT, POPULARITY); mEditor.apply(); updateScreen(); item.setChecked(true); return true; case R.id.rating: mEditor.putString(SHARED_KEY_SORT, RATING); mEditor.apply(); updateScreen(); item.setChecked(true); return true; } return super.onOptionsItemSelected(item); }