List of usage examples for android.view MenuItem getItemId
public int getItemId();
From source file:com.njlabs.amrita.aid.aums.AumsActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: exitAums();//from ww w .j a va 2s . c om return true; case R.id.action_bug_report: Intent intent = new Intent(getApplicationContext(), BugReport.class); intent.putExtra("studentName", (aums.studentName != null ? aums.studentName : "Anonymous")); intent.putExtra("studentRollNo", (aums.studentRollNo != null ? aums.studentRollNo : "0")); startActivity(intent); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.teleca.jamendo.activity.HomeActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.player_menu_item: PlayerActivity.launch(this, (Playlist) null); break;// w w w .j a v a 2 s . co m case R.id.about_menu_item: new AboutDialog(this).show(); break; case R.id.settings_menu_item: SettingsActivity.launch(this); break; default: } return super.onOptionsItemSelected(item); }
From source file:mx.itdurango.rober.siitdocentes.ActivityAlumnos.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.menGuardar) { guardarCambios(gcs);//from w w w. ja v a 2s . c om } else if (id == R.id.menDescargar) { elegirDirectorio(); } if (id == R.id.menCargar) { cargarCSV(); } if (id == R.id.menAcercade) { Estaticos.AcercaDe(this); } return super.onOptionsItemSelected(item); }
From source file:com.echlabsw.android.drawertab.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { if (mDrawerLayout.isDrawerOpen(mDrawerListView)) { mDrawerLayout.closeDrawer(mDrawerListView); } else {// ww w . ja v a 2 s . com mDrawerLayout.openDrawer(mDrawerListView); } } return super.onOptionsItemSelected(item); }
From source file:com.njlabs.amrita.aid.aums.AumsResourcesActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (courseId != null) { if (item.getItemId() == android.R.id.home) { courseId = null;//from w ww . j a v a2 s. com fileNameToDownload = null; CoursesListAdapter adapter = new CoursesListAdapter(courseDatas); recyclerView.setAdapter(adapter); } return true; } else { return super.onOptionsItemSelected(item); } }
From source file:com.skalski.websocketsclient.ActivityMain.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); /* show 'Settings' */ if (id == R.id.action_settings) { Log.i(TAG_LOG, "Starting 'ActivitySettings'"); Intent intent = new Intent(getApplicationContext(), ActivitySettings.class); startActivity(intent);//from ww w . j ava 2 s. c om return true; /* show 'Open Source Licenses' */ } else if (id == R.id.action_licenses) { Log.i(TAG_LOG, "Starting 'LicensesDialog'"); new LicensesDialog(ActivityMain.this, R.raw.notices, false, true).show(); return true; } return super.onOptionsItemSelected(item); }
From source file:net.olejon.mdapp.Icd10ChapterActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { NavUtils.navigateUpFromSameTask(this); return true; }/*from w w w . j a v a2 s . c o m*/ case R.id.icd10_chapter_menu_voice_search: { try { Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "nb-NO"); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); startActivityForResult(intent, VOICE_SEARCH_REQUEST_CODE); } catch (Exception e) { new MaterialDialog.Builder(mContext).title(getString(R.string.device_not_supported_dialog_title)) .content(getString(R.string.device_not_supported_dialog_message)) .positiveText(getString(R.string.device_not_supported_dialog_positive_button)) .contentColorRes(R.color.black).positiveColorRes(R.color.dark_blue).show(); } return true; } default: { return super.onOptionsItemSelected(item); } } }
From source file:com.nttec.everychan.ui.FavoritesFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { View v = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).targetView; Database.FavoritesEntry entry = (FavoritesEntry) v.getTag(); switch (item.getItemId()) { case R.id.context_menu_remove_favorites: MainApplication.getInstance().database.removeFavorite(entry.chan, entry.board, entry.boardPage, entry.thread);//from w w w .j a v a 2s . c om for (Pair<ListView, String> p : listViews) ((FavoritesAdapter) p.getLeft().getAdapter()).remove(entry); return true; case R.id.context_menu_open_browser: UrlHandler.launchExternalBrowser(activity, entry.url); return true; } return false; }
From source file:com.andrada.sitracker.ui.fragment.AuthorsFragment.java
@Override public boolean onActionItemClicked(@NotNull ActionMode mode, @NotNull MenuItem item) { mode.finish();//from w w w. j av a 2 s.c om if (item.getItemId() == R.id.action_remove) { AnalyticsHelper.getInstance().sendEvent(Constants.GA_ADMIN_CATEGORY, Constants.GA_EVENT_AUTHOR_REMOVED, Constants.GA_EVENT_AUTHOR_REMOVED, (long) mSelectedAuthors.size()); //This stuff is on background thread adapter.removeAuthors(mSelectedAuthors); return true; } else if (item.getItemId() == R.id.action_mark_read) { adapter.markAuthorsRead(mSelectedAuthors); AnalyticsHelper.getInstance().sendEvent(Constants.GA_ADMIN_CATEGORY, Constants.GA_EVENT_AUTHOR_MANUAL_READ, Constants.GA_EVENT_AUTHOR_MANUAL_READ, (long) mSelectedAuthors.size()); BackupManager bm = new BackupManager(getActivity()); bm.dataChanged(); return true; } else if (item.getItemId() == R.id.action_open_authors_browser) { for (int i = 0; i < adapter.getCount(); i++) { if (mSelectedAuthors.contains(adapter.getItemId(i))) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(((Author) adapter.getItem(i)).getUrl())); getActivity().startActivity(intent); } } return true; } return false; }
From source file:in.animeshpathak.nextbus.NextBusMain.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.about_menu: startActivity(new Intent(NextBusMain.this, AboutActivity.class)); return true; case R.id.settings_menu: startActivity(new Intent(NextBusMain.this, SettingsActivity.class)); return true; default:/* w ww. j av a 2s. com*/ return super.onOptionsItemSelected(item); } }