List of usage examples for android.view MenuItem getItemId
public int getItemId();
From source file:com.tk.httpClientErp.headmancheck.Headmancheckqianshuzhi.java
/** * ===================================== *///from ww w. ja va 2 s . co m @SuppressWarnings("unchecked") @Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); List<NameValuePair> params = new ArrayList<NameValuePair>(); String reultString = null; switch (item.getItemId()) { case R.id.menu_item_buslist_yes: HashMap<String, Object> hashMapsYES = MyStore.subAndDel(MyStore.headManCheckFenzu); List<JSONObject> submitJsonArrayYES = (List<JSONObject>) hashMapsYES.get("submitJsonArray"); params.add(new BasicNameValuePair("submitJsonArray", submitJsonArrayYES.toString())); try { reultString = HttpClientUtil.postRequest("/android.do?method=qianshuzhi", params, MyStore.sessionID); } catch (TimeoutException e) { e.printStackTrace(); Headmancheckqianshuzhi.this.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(Headmancheckqianshuzhi.this, MyStore.TIMEOUTLOGIN, Toast.LENGTH_SHORT) .show(); } }); } reultString = HttpClientUtil.callBackSuccOrFail(reultString, "resualt"); final String MSG = reultString; Headmancheckqianshuzhi.this.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(Headmancheckqianshuzhi.this, MSG, Toast.LENGTH_SHORT).show(); } }); case R.id.menu_item_buslist_selectec_or_cancle: MyStore.selectORcancle(mResult, "mResult", MyStore.headManCheckFenzu); mResult = mResult == true ? false : true; ((MySimpleAdapter) getListAdapter()).notifyDataSetChanged(); break; } return true; }
From source file:tm.veriloft.mapsplayground.MapsActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.map_routes_clear: //clear them from map for (Polyline drawnRoute : drawnRoutes) drawnRoute.remove();/* ww w . j a v a 2s .c o m*/ for (Marker marker : addedMarkers) marker.remove(); //clear array drawnRoutes.clear(); addedMarkers.clear(); break; case R.id.map_type: AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MapsActivity.this); alertDialogBuilder.setTitle("Choose map type"); alertDialogBuilder.setSingleChoiceItems(mapTypeStrings, lastMapType, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); if (which == lastMapType) return; lastMapType = which; switch (which) { case 0: mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); break; case 1: mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); break; case 2: mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE); break; case 3: mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN); break; } } }); alertDialogBuilder.setNegativeButton("Cancel", null); alertDialogBuilder.show(); break; } return true; }
From source file:app.hacked.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_scavenge_game: { Intent gameIntent = new Intent(this, ScavengerHunt.class); startActivity(gameIntent);/*w w w. j a va 2 s .c o m*/ return true; } } return false; }
From source file:com.example.android.actionbarcompat.morf.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); switch (item.getItemId()) { case R.id.action_search: openSearch();// ww w . ja v a 2 s . c om return true; case R.id.action_settings: openSettings(); return true; case R.id.action_split: openSplit(); return true; case R.id.action_request: openRequest(); return true; case R.id.action_pay: openPay(); return true; case R.id.action_sign_out: signOut(); default: return super.onOptionsItemSelected(item); } }
From source file:com.xengar.android.booksearch.ui.BookDetailActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_share) { setShareIntent();/*from w w w. j av a 2 s .c om*/ return true; } return super.onOptionsItemSelected(item); }
From source file:ca.ualberta.cs.unter.view.DriverSearchRequestActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: startActivity(new Intent(this, DriverMainActivity.class)); return true; default://from w w w .j a va 2 s . c om return super.onOptionsItemSelected(item); } }
From source file:com.librelio.activity.MainMagazineActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case android.R.id.home: finish();// w ww .j ava 2s . c om case R.id.options_menu_reload: // force a redownload of the plist PlistDownloader.doLoad(this, plistName, true); return true; case R.id.options_menu_info: WebViewActivity.startWithUrl(this, getString(R.string.info_url)); return true; case R.id.options_menu_restore: restorePurchases(); return true; case R.id.options_menu_send_log: // onSendLog(); return true; case R.id.options_menu_downloaded_magazines: Intent intent = new Intent(getBaseContext(), DownloadedMagazinesActivity.class); startActivity(intent); return true; case R.id.options_menu_subscribe: Intent subscribeIntent = new Intent(getBaseContext(), BillingActivity.class); startActivity(subscribeIntent); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.mtomczak.nausicaa.MainActivity.java
@Override public boolean onMenuItemSelected(int featureId, MenuItem item) { if (featureId == WindowUtils.FEATURE_VOICE_COMMANDS) { if (item.getItemId() == R.id.set_telemetry_source_option) { Intent intent = new Intent(getBaseContext(), DataSourceActivity.class); intent.putExtra(DATASOURCE_INTENT, telemachusAddress.getPath()); startActivityForResult(intent, 0); }/*from w w w. jav a2s. c om*/ if (item.getItemId() == R.id.toggle_time_scale_option) { toggleStopTimeScalePreference(); } if (item.getItemId() == R.id.docking_view_option) { showSubview(NausicaaSubview.DOCKING); } if (item.getItemId() == R.id.status_view_option) { showSubview(NausicaaSubview.STATUS); } } return true; }
From source file:fr.mdk.kisspush.KISSPush.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_add: openAdd();/* ww w . j a va 2s.c om*/ return true; case R.id.action_help: Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.kisspush.net/")); startActivity(browserIntent); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.hybris.mobile.activity.StoreLocatorActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.current_location: setCurrentUserLocation();/* w w w . ja va 2s. co m*/ return true; default: return false; } }