List of usage examples for android.view MenuItem getItemId
public int getItemId();
From source file:net.noviden.android.shoutout.MainScreen.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. switch (item.getItemId()) { case R.id.action_new_post: openNewPost();//from ww w . j ava2 s. c o m return true; case R.id.action_refresh_posts: refreshPosts(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:pffy.mobile.flax.FlaxActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_about: Toast.makeText(getBaseContext(), this.getVersionInfo(), Toast.LENGTH_LONG).show(); return true; case R.id.action_share: this.sendDetailsByIntent(); return true; default:/*from w w w. j a v a 2s . c om*/ // nothing break; } return super.onOptionsItemSelected(item); }
From source file:com.example.bluetoothlegatt.DeviceControlActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_connect: mBluetoothLeService.connect(mDeviceAddress); return true; case R.id.menu_disconnect: mBluetoothLeService.disconnect(); return true; case android.R.id.home: onBackPressed();//from www .j a v a 2s . com return true; } return super.onOptionsItemSelected(item); }
From source file:com.joefernandez.irrduino.android.remote.IrrduinoRemoteActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { final Intent intent; // Handle item selection switch (item.getItemId()) { case R.id.preferences: intent = new Intent(this, Settings.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);/* w w w . j a va 2s . c o m*/ settingsChanged = true; return true; case R.id.report: intent = new Intent(this, ViewReportActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); return true; default: return super.onOptionsItemSelected(item); } }
From source file:net.majorkernelpanic.spydroid.SpydroidActivity.java
public boolean onOptionsItemSelected(MenuItem item) { Intent intent;/* w w w . jav a 2s .c o m*/ switch (item.getItemId()) { /*case R.id.client: // Starts ClientActivity where user can view stream from another phone intent = new Intent(this.getBaseContext(),ClientActivity.class); startActivityForResult(intent, 0); return true;*/ case R.id.options: // Starts QualityListActivity where user can change the streaming quality intent = new Intent(this.getBaseContext(), OptionsActivity.class); startActivityForResult(intent, 0); return true; case R.id.quit: // Quits Spydroid i.e. stops the HTTP server if (httpServer != null) httpServer.stop(); finish(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:org.teleal.cling.android.browser.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case 0:/* w w w . j a v a 2s. c o m*/ searchNetwork(); break; } return false; }
From source file:com.oscarsalguero.solartracker.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.action_refresh: if (mGoogleApiClient.isConnected()) { startLocationUpdates();//from w w w. j a v a 2 s . com } else { mGoogleApiClient.connect(); } break; case R.id.action_about: Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.git_hub_repo_url))); startActivity(intent); break; default: break; } return super.onOptionsItemSelected(item); }
From source file:net.olejon.spotcommander.AddComputerActivity.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 a v a 2 s . c o m case R.id.add_computer_menu_scan_network: { scanNetwork(); return true; } case R.id.add_computer_menu_add_computer: { addComputer(); return true; } default: { return super.onOptionsItemSelected(item); } } }
From source file:com.esri.UC.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_locate: try {/*ww w .j a va 2 s. c om*/ locateMe(); return true; } catch (Exception e) { e.printStackTrace(); return true; } case R.id.action_settings: switchToSettings(); return true; } return super.onOptionsItemSelected(item); }
From source file:com.imalu.alyou.activity.FriendlistFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { if (item.getItemId() == R.id.delete_contact) { Friend tobeDeleteUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position); // ?//ww w.ja v a 2 s .com // deleteContact(tobeDeleteUser); // ? // InviteMessgeDao dao = new InviteMessgeDao(getActivity()); // dao.deleteMessage(tobeDeleteUser.getUsername()); return true; } else if (item.getItemId() == R.id.add_to_blacklist) { Friend user = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position); // moveToBlacklist(user.getUsername()); return true; } return super.onContextItemSelected(item); }