List of usage examples for android.view MenuItem getItemId
public int getItemId();
From source file:net.amdroid.metrosp.MetroSP.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case MENU_PREFS: { startActivityForResult(new Intent(this, Preferences.class), PREFERENCES_ACTIVITY); return true; }/*from w ww . j a va 2 s. c o m*/ } return false; }
From source file:com.markupartist.sthlmtraveling.FavoritesFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case CONTEXT_MENU_DELETE: getActivity().getContentResolver().delete(ContentUris.withAppendedId(Journeys.CONTENT_URI, menuInfo.id), null, null);/*from ww w . j av a 2 s. com*/ return true; case CONTEXT_MENU_REVERSE_SEARCH: doSearch(menuInfo.id, true); return true; case CONTEXT_MENU_INCREASE_PRIO: updateListPosition(menuInfo.id, true); return true; case CONTEXT_MENU_DECREASE_PRIO: updateListPosition(menuInfo.id, false); return true; } return false; }
From source file:com.andrewshu.android.reddit.reddits.PickSubredditActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Common.goHome(this); break;// w ww. ja va 2 s . co m default: throw new IllegalArgumentException("Unexpected action value " + item.getItemId()); } return true; }
From source file:edu.asu.msse.sgowdru.moviemediaplayerrpc.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { //On options selected from action bar, launch this Dialog class activity Intent i = new Intent(this, SearchMovie.class); switch (item.getItemId()) { case R.id.search_movie: //Put the message to be displayed in the dialog activity which displays ratings of the movie startActivityForResult(i, 1);/* ww w .j a v a 2 s . co m*/ return true; default: return super.onOptionsItemSelected(item); } }
From source file:fm.krui.kruifm.KRUIScheduleActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; }/*from w w w.j av a 2 s . co m*/ return true; }
From source file:jen.jobs.application.UpdateJobSeeking.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int clickedItem = item.getItemId(); if (clickedItem == R.id.save) { if (isOnline) { ArrayList<String> errors = new ArrayList<>(); if (selectedJobSeekingStatusValues == null) { errors.add("Please select jobseeking status!"); }//w ww. j a va 2 s .c o m if (selectedAvailability.length() == 0 && selectedAvailabilityUnit.length() == 0) { errors.add("Please select your notice period!"); } if (selectedCountryValues == null) { errors.add("Please select the country!"); } else { if (selectedCountryValues.id == 127) { if (selectedMalaysiaStateValues == null) { errors.add("Please select the state!"); } } } if (errors.size() == 0) { JSONObject obj = new JSONObject(); // TODO - save to profile, local db ContentValues cv = new ContentValues(); cv.put("js_jobseek_status_id", selectedJobSeekingStatusValues.id); cv.put("driving_license", cbLicense.isChecked() ? 1 : 0); cv.put("transport", cbTransport.isChecked() ? 1 : 0); cv.put("availability", selectedAvailability); cv.put("availability_unit", selectedAvailabilityUnit.substring(0, 1)); tableProfile.updateProfile(cv, profileId); // TODO - save to address, add address to parameter ContentValues cv2 = new ContentValues(); if (selectedMalaysiaStateValues != null) { cv2.put("state_id", selectedMalaysiaStateValues.id); cv2.put("state_name", selectedMalaysiaStateValues.name); } else { cv2.put("state_id", 0); cv2.put("state_name", ""); } cv2.put("country_id", selectedCountryValues.id); cv2.put("updated_at", Jenjobs.date(null, "yyyy-MM-dd", null)); tableAddress.updateAddress(cv2); // update POST data try { obj.put("js_jobseek_status_id", cv.getAsString("js_jobseek_status_id")); obj.put("driving_license", cv.getAsString("driving_license")); obj.put("transport", cv.getAsString("transport")); obj.put("availability", cv.getAsString("availability")); obj.put("availability_unit", cv.getAsString("availability_unit")); obj.put("state_id", cv.getAsString("state_id")); obj.put("country_id", cv.getAsString("country_id")); } catch (JSONException e) { Log.e("err", e.getMessage()); } // TODO - change cv to ArrayList -> String, post to server String accessToken = sharedPref.getString("access_token", null); PostRequest p = new PostRequest(); p.setResultListener(new PostRequest.ResultListener() { @Override public void processResult(JSONObject success) { if (success != null) { try { success.get("status_code"); } catch (JSONException e) { Log.e("test", e.getMessage()); } } } }); String[] s = { Jenjobs.JOBSEEKING_INFO + "?access-token=" + accessToken, obj.toString() }; p.execute(s); Intent intent = new Intent(); intent.putExtra("summary", selectedJobSeekingStatusValues.name); setResult(Activity.RESULT_OK, intent); finish(); } else { Toast.makeText(getApplicationContext(), TextUtils.join(", ", errors), Toast.LENGTH_LONG).show(); } } else { Toast.makeText(getApplicationContext(), R.string.network_error, Toast.LENGTH_LONG).show(); } } return true; }
From source file:net.kourlas.voipms_sms.activities.ConversationsActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.preferences_button: Intent preferencesIntent = new Intent(this, PreferencesActivity.class); startActivity(preferencesIntent); return true; case R.id.help_button: Intent helpIntent = new Intent(this, HelpActivity.class); startActivity(helpIntent);// w ww. j a va2s . co m return true; case R.id.credits_button: Intent creditsIntent = new Intent(this, CreditsActivity.class); startActivity(creditsIntent); return true; case R.id.donate_button: billing.preDonation(this); default: return super.onOptionsItemSelected(item); } }
From source file:com.dnielfe.manager.AppManager.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish();//from www. j a v a 2s . c o m return true; case R.id.shortcut: createshortcut(); return true; case R.id.deleteapps: final DialogFragment dialog1 = DeleteFilesDialog .instantiate(new String[] { SimpleExplorer.BACKUP_LOC }); dialog1.show(getFragmentManager(), "dialog"); return true; case R.id.actionselect: if (multiSelectData.size() < mAppList.size()) selectAll(); else unselectAll(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEvent.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { finish();//w w w . j a v a 2s . co m return true; } case R.id.AddLog: { addMessageDialog = new Dialog(ViewZenossEvent.this); addMessageDialog.setContentView(R.layout.add_message); addMessageDialog.setTitle("Add Message to Event Log"); ((Button) addMessageDialog.findViewById(R.id.SaveButton)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { AddLogMessage(((EditText) addMessageDialog.findViewById(R.id.LogMessage)).getText().toString()); addMessageDialog.dismiss(); } }); addMessageDialog.show(); return true; } case R.id.escalate: { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); // Add data to the intent, the receiving app will decide what to do with it. intent.putExtra(Intent.EXTRA_SUBJECT, "Escalation of Zenoss Event on " + getIntent().getStringExtra("Device")); String EventDetails = getIntent().getStringExtra("Summary") + "\r\r\n" + getIntent().getStringExtra("LastTime") + "\r\r\n" + "Count: " + getIntent().getIntExtra("Count", 0); intent.putExtra(Intent.EXTRA_TEXT, EventDetails); startActivity(Intent.createChooser(intent, "How would you like to escalate this event?")); } default: { return false; } } }
From source file:net.olejon.mdapp.NotesEditActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { showSaveNoteDialog();//from w ww .ja v a 2s .c om return true; } case R.id.notes_edit_menu_save: { saveNote(); return true; } default: { return super.onOptionsItemSelected(item); } } }