List of usage examples for android.view MenuItem getItemId
public int getItemId();
From source file:com.skubit.iab.activities.TransactionDetailsActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish();/*w w w .j av a2 s . c om*/ overridePendingTransition(R.anim.none, R.anim.push_out_right); return true; } return super.onOptionsItemSelected(item); }
From source file:at.bitfire.davdroid.syncadapter.LoginURLFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.next: FragmentTransaction ft = getFragmentManager().beginTransaction(); Bundle args = new Bundle(); try {//from w w w . j ava 2 s . c o m args.putString(QueryServerDialogFragment.EXTRA_BASE_URI, getBaseURI().toString()); } catch (URISyntaxException e) { } args.putString(QueryServerDialogFragment.EXTRA_USER_NAME, editUserName.getText().toString()); args.putString(QueryServerDialogFragment.EXTRA_PASSWORD, editPassword.getText().toString()); args.putBoolean(QueryServerDialogFragment.EXTRA_AUTH_PREEMPTIVE, checkboxPreemptive.isChecked()); DialogFragment dialog = new QueryServerDialogFragment(); dialog.setArguments(args); dialog.show(ft, QueryServerDialogFragment.class.getName()); break; default: return false; } return true; }
From source file:no.ntnu.idi.socialhitchhiking.utility.SocialHitchhikingActivity.java
@Override /**//from w ww .j a v a 2 s .c o m * Defines what happens when you click a {@link MenuItem} */ public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.menu_setting) { startSettingsActvity(); return true; } else { return super.onOptionsItemSelected(item); } }
From source file:com.example.android.networkconnect.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // When the user clicks FETCH, fetch the first 500 characters of // raw HTML from www.google.com. case R.id.fetch_action: new DownloadTask().execute("http://www.google.com"); return true; // Clear the log view fragment. case R.id.clear_action: mLogFragment.getLogView().setText(""); return true; }// w w w . ja va2 s .c o m return false; }
From source file:pl.bcichecki.rms.client.android.fragments.UsersListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.fragment_users_list_menu_refresh) { downloadData();// w ww . j a v a 2 s .com return true; } return super.onOptionsItemSelected(item); }
From source file:com.guipenedo.pokeradar.activities.settings.PokemonFilterSettingsActivity.java
@Override public boolean onOptionsItemSelected(MenuItem menuItem) { switch (menuItem.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(PokemonFilterSettingsActivity.this); }/*from www . ja va2 s. co m*/ return (super.onOptionsItemSelected(menuItem)); }
From source file:net.olejon.mdapp.PharmaciesLocationMapActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { finish();//from w w w.j a va 2 s. c om return true; } default: { return super.onOptionsItemSelected(item); } } }
From source file:com.barryku.android.boxnet.BrowseActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.logout: RestTemplate rest = RestUtil.getRestTemplate(); RestResponse response = rest.getForObject(getString(R.string.logout_uri), RestResponse.class, apiKey, authToken);//from w w w .j ava2 s . c o m Log.d(LOG_TAG, "log out with status:" + response.getStatus()); clearPreferences(PreferenceManager.getDefaultSharedPreferences(this)); break; } return super.onOptionsItemSelected(item); }
From source file:at.florian_lentsch.expirysync.RegistrationActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: this.setResult(RESULT_CANCELED); this.finish(); return true; }/*w w w .j a va 2s . co m*/ return super.onOptionsItemSelected(item); }
From source file:com.aqnote.app.wifianalyzer.about.AboutActivityTest.java
@Test public void testOnOptionsItemSelectedWithHome() throws Exception { // setup/*ww w . j a va2 s. c o m*/ MenuItem menuItem = mock(MenuItem.class); when(menuItem.getItemId()).thenReturn(android.R.id.home); // execute boolean actual = fixture.onOptionsItemSelected(menuItem); // validate assertTrue(actual); verify(menuItem).getItemId(); }