// Cuando se pulsa un elemento del menú. @Override public boolean onOptionsItemSelected(MenuItem item) { // Dependiendo del item pulsado se realiza la acción deseada. switch (item.getItemId()) { case android.R.id.home: mostrarTostada(getString(R.string.ir_a_la_actividad_superior)); break; case R.id.mnuAgregar: mostrarTostada(getString(R.string.agregar)); break; case R.id.mnuCargar: mostrarTostada(getString(R.string.cargar)); break; case R.id.mnuEditar: mostrarTostada(item.getTitle().toString()); break; case R.id.mnuEliminar: mostrarTostada(getString(R.string.eliminar)); break; case R.id.mnuBuscar: mostrarTostada(getString(R.string.buscar)); break; case R.id.mnuCompartir: mostrarTostada(getString(R.string.compartir)); break; default: return super.onOptionsItemSelected(item); } // Retorna que ya ha sido gestionado. return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; } if (item.getTitle().equals("가입")) { if (member_name_edit_text.getText().length() < 2) { Toast.makeText(getApplicationContext(), "이름은 2자 이상!", Toast.LENGTH_LONG).show(); return true; } else if (member_phone_num_edit_text.getText().length() < 11) { Toast.makeText(getApplicationContext(), "전화번호가 올바르지 않습니다!", Toast.LENGTH_LONG).show(); return true; } else { showDialog(0); name = member_name_edit_text.getText().toString(); phone = member_phone_num_edit_text.getText().toString(); if (resized != null) { bm = resized; } new Usercreate().execute(); return true; } } return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home || item.getItemId() == 0) { return false; } THEME = item.getItemId(); Toast.makeText(this, "Theme changed to \"" + item.getTitle() + "\"", Toast.LENGTH_SHORT).show(); return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getTitle().equals("Create")) { Intent intent = new Intent(getActivity(), AgendaSettings.class); startActivity(intent); return true; } else return super.onOptionsItemSelected(item); }
public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { Intent intent = new Intent(this, ListActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } else if (item.getTitle().toString() == "DropBox") { mDBApi.getSession().startAuthentication(ListActivity.this); } else if (item.getTitle().toString() == "Google Drive") { } else if (item.getTitle().toString() == "Search") { } else if (item.getTitle().toString() == "My Profile") { } else if (item.getTitle().toString() == "Settings") { } else if (item.getTitle().toString() == "Log Out") { } return true; }