List of usage examples for android.view MenuItem getItemId
public int getItemId();
From source file:at.general.solutions.android.ical.activity.ICalSynchronizeActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // We have only one menu option case R.id.configMenuItem: // Launch Preference activity Intent i = new Intent(ICalSynchronizeActivity.this, ICalPreferencesActicity.class); startActivity(i);// w w w. jav a 2s .co m break; } return true; }
From source file:org.lumicall.android.sip.RegisterAccount.java
@Override public boolean onOptionsItemSelected(MenuItem item) { boolean result = super.onOptionsItemSelected(item); switch (item.getItemId()) { case ABOUT_MENU_ITEM: if (m_AlertDlg != null) { m_AlertDlg.cancel();//from w ww.j a va2 s. c om } m_AlertDlg = new AlertDialog.Builder(this) .setMessage(getString(R.string.about).replace("\\n", "\n").replace("${VERSION}", Sipdroid.getVersion(this))) .setTitle(getString(R.string.menu_about)).setIcon(R.drawable.icon22).setCancelable(true).show(); break; } return result; }
From source file:com.abid_mujtaba.bitcoin.tracker.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.sampling_interval: change_sampling_interval();/*from ww w . j av a 2 s. c o m*/ break; case R.id.sampling_window: change_sampling_window(); break; case R.id.current_price: new FetchCurrentPriceTask().execute(); break; } return super.onOptionsItemSelected(item); }
From source file:com.example.google.maps.dataviz.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (mMap == null) { return true; }// w ww . ja v a2 s . c o m switch (item.getItemId()) { // Rotate the camera 360 deg. case R.id.action_rotate: if (mAnimator != null && mAnimator.isRunning()) { mAnimator.cancel(); } else { mAnimator = ValueAnimator.ofFloat(0, 360); mAnimator.setDuration(3000); mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) @Override public void onAnimationUpdate(ValueAnimator animation) { float bearing = (Float) animation.getAnimatedValue(); CameraPosition pos = CameraPosition.builder(mMap.getCameraPosition()).bearing(bearing) .build(); mMap.moveCamera(CameraUpdateFactory.newCameraPosition(pos)); } }); mAnimator.start(); } return true; // Chance the camera perspective. case R.id.action_perspective: CameraPosition currentPosition = mMap.getCameraPosition(); CameraPosition newPosition; if (currentPosition.zoom == CAMERA_OBLIQUE_ZOOM && currentPosition.tilt == CAMERA_OBLIQUE_TILT) { newPosition = new CameraPosition.Builder().tilt(0).zoom(mInitZoom).bearing(0).target(mInitPosition) .build(); } else { newPosition = new CameraPosition.Builder().tilt(CAMERA_OBLIQUE_TILT).zoom(CAMERA_OBLIQUE_ZOOM) .bearing(currentPosition.bearing).target(currentPosition.target).build(); } mMap.animateCamera(CameraUpdateFactory.newCameraPosition(newPosition)); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.mobshep.sessionmanagement.MainActivity.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(); switch (id) { case R.id.action_settings: Intent goToSettings = new Intent(this, Preferences.class); startActivity(goToSettings);//ww w . j a v a 2 s. c o m return true; case R.id.action_restart: storedPref = getSharedPreferences("Sessions", MODE_WORLD_READABLE); toEdit = storedPref.edit(); toEdit.putString("SessionToken", ""); toEdit.commit(); break; case R.id.action_exit: this.finish(); break; default: } return super.onOptionsItemSelected(item); }
From source file:com.medisa.myspacecal.Range.java
@Override public boolean onOptionsItemSelected(android.view.MenuItem item) { // TODO Auto-generated method stub switch (item.getItemId()) { case android.R.id.home: sideNavigationView.toggleMenu(); break;//from w ww .j av a 2 s . c o m // case R.id.mode_left: // item.setChecked(true); // sideNavigationView.setMode(Mode.LEFT); // break; // case R.id.mode_right: // item.setChecked(true); // sideNavigationView.setMode(Mode.RIGHT); // break; // default: return super.onOptionsItemSelected(item); } return super.onOptionsItemSelected(item); }
From source file:com.royclarkson.springagram.GalleryListFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case R.id.action_delete: deleteGallery(info.position);/*w w w . j av a2s. c om*/ return true; default: return super.onContextItemSelected(item); } }
From source file:com.example.vendrisample.HelloEffects.java
License:asdf
@Override public boolean onOptionsItemSelected(final MenuItem item) { setCurrentEffect(item.getItemId()); mEffectView.requestRender();/* w ww .j ava 2 s. c o m*/ return true; }
From source file:com.samknows.measurement.activity.SamKnowsMapActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: ////from w w w.j a v a 2 s. c om // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpTo(this, new Intent(this, SamKnowsAggregateStatViewerActivity.class)); return true; } return super.onOptionsItemSelected(item); }
From source file:com.notifry.android.ChooseAccount.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent intent = new Intent(this, Notifry.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);//w w w. j a va 2 s . c o m return true; case REFRESH_IDS: // Dispatch this to the updater service. Intent intentData = new Intent(getBaseContext(), UpdaterService.class); intentData.putExtra("type", "registration"); intentData.putExtra("registration", C2DMessaging.getRegistrationId(this)); startService(intentData); Toast.makeText(thisActivity, getString(R.string.background_refreshing), Toast.LENGTH_SHORT).show(); return true; } return super.onOptionsItemSelected(item); }