List of usage examples for android.view MenuItem getItemId
public int getItemId();
From source file:pl.bcichecki.rms.client.android.activities.NewMessageActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.activity_new_message_menu_send) { performActionSend(item);//from ww w. ja va 2 s . c o m return true; } if (item.getItemId() == android.R.id.home) { NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); }
From source file:com.ame.armymax.SearchActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { int itemId = item.getItemId(); AdapterContextMenuInfo aInfo = (AdapterContextMenuInfo) item.getMenuInfo(); resultList.remove(aInfo.position);/*from w w w. j a v a 2 s . c om*/ adapter.notifyDataSetChanged(); return true; }
From source file:com.scooter1556.sms.android.fragment.AudioDirectoryFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.play_all: mediaElementListener.PlayAll(mediaElements); return true; case R.id.add_all_and_play_next: mediaElementListener.AddAllAndPlayNext(mediaElements); return true; case R.id.add_all_to_queue: mediaElementListener.AddAllToQueue(mediaElements); return true; default:/* www . j av a 2s.c o m*/ return super.onOptionsItemSelected(item); } }
From source file:com.appteam.nimbus.activity.homeActivity.java
@SuppressWarnings("StatementWithEmptyBody") @Override/*from w w w .ja v a2s.com*/ public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.navigation_to_profile) { // Handle the camera action Intent i = new Intent(homeActivity.this, Profile.class); startActivity(i); } else if (id == R.id.aboutus_nav) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(String.format("%1$s", getString(R.string.app_name))); builder.setMessage(getResources().getText(R.string.aboutus_text)); builder.setPositiveButton("OK", null); builder.setIcon(R.mipmap.nimbus16); AlertDialog welcomeAlert = builder.create(); welcomeAlert.show(); ((TextView) welcomeAlert.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } else if (id == R.id.feedback_nav) { Intent intent = new Intent(Intent.ACTION_SENDTO); String uriText = "mailto:" + Uri.encode("appteam.nith@gmail.com") + "?subject=" + Uri.encode("Reporting A Bug/Feedback") + "&body=" + Uri.encode( "Hello, Appteam \nI want to report a bug/give feedback corresponding to the app Nimbus 2k16.\n.....\n\n-Your name"); Uri uri = Uri.parse(uriText); intent.setData(uri); startActivity(Intent.createChooser(intent, "Send Email")); } else if (id == R.id.opensourcelicenses_nav) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(String.format("%1$s", getString(R.string.open_source_licenses))); builder.setMessage(getResources().getText(R.string.licenses_text)); builder.setPositiveButton("OK", null); //builder.setIcon(R.mipmap.nimbus_icon); AlertDialog welcomeAlert = builder.create(); welcomeAlert.show(); ((TextView) welcomeAlert.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } else if (id == R.id.contributors_nav) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(String.format("%1$s", getString(R.string.contributors))); builder.setMessage(getResources().getText(R.string.contributors_text)); builder.setPositiveButton("OK", null); //builder.setIcon(R.mipmap.nimbus_icon); AlertDialog welcomeAlert = builder.create(); welcomeAlert.show(); ((TextView) welcomeAlert.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } else if (id == R.id.notifications) { startActivity(new Intent(homeActivity.this, ViewActivity.class)); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; }
From source file:com.hybris.mobile.activity.StoreLocatorDetailActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Clicking on the geofence icon case R.id.geofence_store: // If the geofence functionnality is not activated we display an error message if (!Hybris.isGeofencingActivated()) { Toast.makeText(this, R.string.error_geofence_not_activated, Toast.LENGTH_LONG); } else {/*www . jav a 2 s . co m*/ // If the geofence is already activated for that store, clicking on it will disable the geofence if (geofenceJsonSharedPreferences.getGeofenceObject(store.getName()) != null) { item.setIcon(R.drawable.ic_menu_location_default); enableGeofence(false); } // In the other case we activate it else { item.setIcon(R.drawable.ic_menu_location_active); enableGeofence(true); } } return true; default: return false; } }
From source file:com.purplefrog.glitchclocka.LearningReadout.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.refresh: refreshLearningData();//ww w .ja va 2 s.c o m return true; case R.id.about: if (true) { startActivity(new Intent(this, AboutActivity.class)); } else { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("file:///android_asset/about.html"))); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:net.reichholf.dreamdroid.fragment.ScreenShotFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case Statics.ITEM_RELOAD: reload();/*from www. j a v a 2 s.c o m*/ break; case Statics.ITEM_SAVE: saveToFile(); } return true; }
From source file:com.ame.armymax.SearchActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent upIntent = new Intent(this, MainActivity.class); if (NavUtils.shouldUpRecreateTask(this, upIntent)) { TaskStackBuilder.from(this).addNextIntent(upIntent).startActivities(); finish();/*from www .j a v a 2 s. co m*/ } else { NavUtils.navigateUpTo(this, upIntent); } return true; } return super.onOptionsItemSelected(item); }
From source file:cycronix.CTandroid.CTAserver.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { default://from w w w.ja v a2s . c o m return super.onOptionsItemSelected(item); } }
From source file:org.fundsofhope.androidapp.activities.MainActivity.java
public void selectDrawerItem(MenuItem menuItem) { Intent intent;/* w w w.j av a2 s . c om*/ switch (menuItem.getItemId()) { case R.id.nav_first_fragment: intent = new Intent(this, MainActivity.class); break; case R.id.nav_second_fragment: intent = new Intent(this, TransitionFirstActivity.class); break; case R.id.nav_third_fragment: intent = new Intent(this, ProjectsActivity.class); break; default: intent = new Intent(this, MainActivity.class); break; } startActivity(intent); menuItem.setChecked(true); setTitle(menuItem.getTitle()); mDrawer.closeDrawers(); }