List of usage examples for android.view MenuItem getItemId
public int getItemId();
From source file:net.olejon.mdapp.NasjonaleRetningslinjerActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { NavUtils.navigateUpFromSameTask(this); return true; }/*w w w . j ava 2 s .c om*/ case R.id.nasjonale_retningslinjer_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; } case R.id.nasjonale_retningslinjer_menu_clear_recent_searches: { clearRecentSearches(); return true; } default: { return super.onOptionsItemSelected(item); } } }
From source file:com.ardnezar.lookapp.ConnectActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items. if (item.getItemId() == R.id.action_settings) { Intent intent = new Intent(this, SettingsActivity.class); startActivity(intent);//from ww w .j a va2 s . com return true; } else { return super.onOptionsItemSelected(item); } }
From source file:it.gulch.linuxday.android.fragments.EventDetailsFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.bookmark: if (isBookmarked != null) { new UpdateBookmarkAsyncTask(event).execute(isBookmarked); }/*from ww w . j ava2 s.c o m*/ return true; case R.id.add_to_agenda: addToAgenda(); return true; } return false; }