List of usage examples for android.view MenuItem getItemId
public int getItemId();
From source file:com.teinproductions.tein.papyrosprogress.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.visitHomepage: openWebPage(this, "http://papyros.io"); try {/*from w w w. j ava2 s . c o m*/ IOUtils.sendGAEventHit(this, Constants.GA_EXTERNAL_LINKS_EVENT_CATEGORY, "Visit papyros.io", null); } catch (Exception e) { // I don't want to cause this any errors, // because that would seem weird to the user } return true; case R.id.visitGithub: openWebPage(this, "https://github.com/papyros"); try { IOUtils.sendGAEventHit(this, Constants.GA_EXTERNAL_LINKS_EVENT_CATEGORY, "Visit Github page", null); } catch (Exception ignored) { /*ignored*/ } return true; case R.id.action_settings: startActivityForResult(new Intent(this, SettingsActivity.class), SETTINGS_ACTIVITY_REQUEST_CODE); default: return false; } }
From source file:com.locution.hereyak.LoginActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_legalnotices: String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext()); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(this); LicenseDialog.setTitle("Legal Notices"); LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show();/*from w w w . j a va 2s. c o m*/ return true; } return super.onOptionsItemSelected(item); }
From source file:io.indy.seni.ui.EvolveGridFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.clear_cache: mImageGenerator.clearCache();/* w ww . j av a 2s . c o m*/ Toast.makeText(getActivity(), R.string.clear_cache_complete_toast, Toast.LENGTH_SHORT).show(); return true; } return super.onOptionsItemSelected(item); }
From source file:net.reichholf.dreamdroid.abstivities.AbstractHttpActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { return onItemClicked(item.getItemId()); }
From source file:com.tk.httpClientErp.buscheck.BusListActivity.java
/** * /*from ww w. ja va 2 s. com*/ */ @SuppressWarnings("unchecked") @Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); List<NameValuePair> params = new ArrayList<NameValuePair>(); switch (item.getItemId()) { // case R.id.menu_item_buslist_yes: HashMap<String, Object> busListHashMaps = MyStore.subAndDel(MyStore.busList); List<JSONObject> submitJsonArray = (List<JSONObject>) busListHashMaps.get("submitJsonArray"); List<HashMap<String, Object>> delList = (List<HashMap<String, Object>>) busListHashMaps.get("delList"); params.add(new BasicNameValuePair("submitJsonArray", submitJsonArray.toString())); String reultString = null; try { reultString = HttpClientUtil.postRequest("/android.do?method=checkBusList", params, MyStore.sessionID); } catch (TimeoutException e) { e.printStackTrace(); BusListActivity.this.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(BusListActivity.this, MyStore.TIMEOUTLOGIN, Toast.LENGTH_SHORT).show(); } }); } if (HttpClientUtil.reSUCCorFAILE && delList.size() != 0) MyStore.busList.removeAll(delList); reultString = HttpClientUtil.callBackSuccOrFail(reultString, "resualt"); final String MSG = reultString; BusListActivity.this.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(BusListActivity.this, MSG, Toast.LENGTH_SHORT).show(); } }); ((SimpleAdapter) getListAdapter()).notifyDataSetChanged(); break; // / case R.id.menu_item_buslist_selectec_or_cancle: MyStore.selectORcancle(mResult, "mResult", MyStore.busList); mResult = mResult == true ? false : true; ((SimpleAdapter) getListAdapter()).notifyDataSetChanged(); break; } return true; }
From source file:com.example.maproot.MainActivity.java
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_A:// www. ja v a 2 s .c o m //show_mapInfo(); return true; case MENU_B: //Legal Notices(?) String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext()); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(MainActivity.this); LicenseDialog.setTitle("Legal Notices"); LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show(); return true; case MENU_c: //show_settings(); return true; } return false; }
From source file:com.javierc.albuquerquenow.TransitMap.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub if (item.getItemId() == R.id.offline_routes) { if (item.isChecked()) { item.setChecked(false);//from w w w.ja va 2 s. c o m useOfflineRoutes = false; } else { item.setChecked(true); useOfflineRoutes = true; } } else if (item.getItemId() == R.id.action_legalnotices) { String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext()); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(TransitMap.this); LicenseDialog.setTitle("Legal Notices"); LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show(); } else if (item.getItemId() == R.id.bus_refresh) { //first delete all the current markers refreshMarkers(); //plot new markers plotBus(actionBar.getSelectedNavigationIndex()); } else if (item.getItemId() == R.id.bus_stops) { new PlotStopsTask(this).execute(); } return super.onOptionsItemSelected(item); }
From source file:com.chess.genesis.activity.GameListLocalFrag.java
@Override public boolean onContextItemSelected(final MenuItem item) { if (!act.lastContextMenu.equals(getBTag())) return super.onContextItemSelected(item); switch (item.getItemId()) { case R.id.new_game: case R.id.import_game: return onOptionsItemSelected(item); }//from www .j a va 2s. co m final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); final Bundle bundle = (Bundle) gamelist_adapter.getItem((int) info.id); switch (item.getItemId()) { case R.id.delete_game: new DeleteLocalDialog(act, handle, Integer.parseInt(bundle.getString("id"))).show(); break; case R.id.rename_game: new RenameGameDialog(act, handle, Integer.parseInt(bundle.getString("id")), bundle.getString("name")) .show(); break; case R.id.share_game: sendGame(bundle); break; default: return super.onContextItemSelected(item); } return true; }
From source file:com.example.ramap.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub switch (item.getItemId()) { //TODO: Open HistoryActivity.java with ListView Array of SharedPreferences values. case R.id.check_in_history_menu: SharedPreferences loadHistory = getSharedPreferences(SAVE, MODE_PRIVATE); currentLocation = loadHistory.getString("name", "You're not checked in!"); //currentLocation.setText(String.valueOf(notCheckedIn)); loadHistory.getString(SAVE, ""); Toast.makeText(getApplicationContext(), ("Previous check in loaded successfully!\n" + currentLocation), Toast.LENGTH_SHORT).show(); //Intent intent = new Intent (getApplicationContext(), HistoryActivity.class); //startActivity(intent); // starts break;// w w w. ja v a 2 s. c om //TODO: This should open a SettingsActivity.java to change settings on the application. //case R.id.settings_menu: // Toast.makeText(getBaseContext(), "Settings option doesn't work yet.", Toast.LENGTH_SHORT).show(); // break; case R.id.about_menu: AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("About RaMap"); alertDialog.setMessage("Developed for CISC 4400 by:\n" + "Joseph LeRoy\n" + "Kevin McCarthy\n" + "Alexander Despotakis\n" + "Fizan Imtiaz"); alertDialog.show(); //Toast.makeText(getBaseContext(), "Created by: Joseph LeRoy, Kevin McCarthy, Alexander Despotakis, Fizan Imtiaz", Toast.LENGTH_SHORT).show(); } return super.onOptionsItemSelected(item); }
From source file:com.krayzk9s.imgurholo.ui.CommentsFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // handle item selection switch (item.getItemId()) { //none right now case R.id.action_refresh: getComments();/*from w ww.j a v a 2 s . c o m*/ return true; default: return super.onOptionsItemSelected(item); } }