List of usage examples for android.view MenuItem getItemId
public int getItemId();
From source file:com.chess.genesis.activity.UserStatsFrag.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { if (item.getItemId() == R.id.userlookup) { new StatsLookupDialog(act, handle).show(); return true; }//from w ww . j av a 2 s. co m return super.onOptionsItemSelected(item); }
From source file:nya.miku.wishmaster.ui.settings.AutohideActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { if (item.getItemId() == R.id.context_menu_delete) { if (item.getMenuInfo() != null && item.getMenuInfo() instanceof AdapterView.AdapterContextMenuInfo) { int position = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position; if (position > 0) { rulesJson.remove(position - 1); rulesChanged();/*w ww. j av a2s . c o m*/ } } } return super.onContextItemSelected(item); }
From source file:com.secretparty.app.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: getSupportFragmentManager().popBackStack(); return true; case R.id.action_settings: return true; case R.id.action_add: FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag("Dialog"); if (prev != null) ft.remove(prev);/*from w w w .j a va 2 s. co m*/ ft.addToBackStack(null); DialogFragment frag = PartyCreationDialog.newInstance(); frag.show(ft, "dialog"); return true; } return super.onOptionsItemSelected(item); }
From source file:fr.simon.marquis.secretcodes.ui.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_scan: startService(new Intent(this, CrawlerService.class)); break;/* w w w. j a v a 2s .c o m*/ case R.id.action_cancel: stopService(new Intent(this, CrawlerService.class)); break; case R.id.show_popop: showAboutDialog(false); break; case R.id.action_online_database: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.online_database_url)))); break; case R.id.action_contribute: exportSecretCodes(); break; default: break; } return super.onOptionsItemSelected(item); }
From source file:com.example.joseba.sunshine.app.ForecastFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_refresh) { updateWeather();//from w ww . j a v a 2 s.co m return true; } return super.onOptionsItemSelected(item); }
From source file:com.example.office365sample.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_RESET_TOKEN: { resetToken();/*from w w w . j a va 2 s .c om*/ clearCookies(); return true; } case MENU_LOGIN: { doLogin(); return true; } case MENU_READ_MESSAGES: { readMessages(); return true; } default: return super.onOptionsItemSelected(item); } }
From source file:com.example.healthplus.wifidirect.WiFiDirectActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.atn_direct_enable: if (manager != null && channel != null) { // Since this is the system wireless settings activity, it's // not going to send us a result. We will be notified by // WiFiDeviceBroadcastReceiver instead. startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } else {/* ww w . j av a2 s . c o m*/ Log.e(TAG, "channel or manager is null"); } return true; case R.id.atn_direct_discover: if (!isWifiP2pEnabled) { Toast.makeText(WiFiDirectActivity.this, R.string.p2p_off_warning, Toast.LENGTH_SHORT).show(); return true; } final DeviceListFragment fragment = (DeviceListFragment) getFragmentManager() .findFragmentById(R.id.frag_list); fragment.onInitiateDiscovery(); manager.discoverPeers(channel, new WifiP2pManager.ActionListener() { @Override public void onSuccess() { Toast.makeText(WiFiDirectActivity.this, "Discovery Initiated", Toast.LENGTH_SHORT).show(); } @Override public void onFailure(int reasonCode) { Toast.makeText(WiFiDirectActivity.this, "Discovery Failed : " + reasonCode, Toast.LENGTH_SHORT) .show(); } }); return true; default: return super.onOptionsItemSelected(item); } }
From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.activities.MainActivity.java
@Override public boolean onNavigationItemSelected(MenuItem item) { Log.d(TAG, "onNavigationItemsSelected " + hashCode()); int id = item.getItemId(); if (R.id.nav_sign_browser == id) { showSignBrowser();/* ww w . ja v a 2s.co m*/ } else if (R.id.nav_sign_trainer_passive == id) { showSignTrainer(LearningMode.PASSIVE); } else if (R.id.nav_sign_trainer_active == id) { showSignTrainer(LearningMode.ACTIVE); } else if (R.id.nav_sign_info == id) { showAboutSigns(); } // #54 Settings view currently deactivated. // else if (R.id.nav_sign_settings == id) { // showSettings(); // } final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); Validate.notNull(drawer); drawer.closeDrawer(GravityCompat.START); return true; }
From source file:com.radicaldynamic.groupinform.activities.AccountDeviceList.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_ADD: return true; }//from w w w . j a v a 2 s. co m return super.onOptionsItemSelected(item); }
From source file:com.rei.lolchat.ui.Login.java
@Override public final boolean onOptionsItemSelected(MenuItem item) { boolean result; switch (item.getItemId()) { case R.id.login_menu_settings: mTextView.setText(""); startActivity(new Intent(Login.this, Settings.class)); result = true;/* w ww. j a va 2 s .c o m*/ break; case R.id.login_menu_about: createAboutDialog(); result = true; break; case R.id.login_menu_login: if (mBeemApplication.isAccountConfigured()) { Intent i = new Intent(this, LoginAnim.class); startActivityForResult(i, LOGIN_REQUEST_CODE); } result = true; break; default: result = false; break; } return result; }