/** * Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity * in the process. upIntent will have the flag {@link android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP} set * by this method, along with any others required for proper up navigation as outlined * in the Android Design Guide. * * <p>This method should be used when performing up navigation from within the same task * as the destination. If up navigation should cross tasks in some cases, see * {@link #supportShouldUpRecreateTask(android.content.Intent)}.</p> * * @param upIntent An intent representing the target destination for up navigation */ public void supportNavigateUpTo(Intent upIntent) { NavUtils.navigateUpTo(this, upIntent); }
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case android.R.id.home: { Intent intent = new Intent(this, org.schabi.newpipe.MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); NavUtils.navigateUpTo(this, intent); return true; } default: return false; } } }
private void goToReturnActivity() { Class<? extends Activity> checkedReturnActivity = getReturnActivity(returnActivity); if (checkedReturnActivity == null) { super.onBackPressed(); } else { Intent intent = new Intent(this, checkedReturnActivity); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); NavUtils.navigateUpTo(this, intent); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Respond to the action bar's Up/Home button case android.R.id.home: Intent upIntent = NavUtils.getParentActivityIntent(this); upIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); if (NavUtils.shouldUpRecreateTask(this, upIntent)) { // This activity is NOT part of this app's task, so create a new task // when navigating up, with a synthesized back stack. TaskStackBuilder.create(this) // Add all of this activity's parents to the back stack .addNextIntentWithParentStack(upIntent) // Navigate up to the closest parent .startActivities(); } else { // This activity is part of this app's task, so simply // navigate up to the logical parent activity. NavUtils.navigateUpTo(this, upIntent); } return true; } return super.onOptionsItemSelected(item); }
/** * Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity * in the process. upIntent will have the flag {@link android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP} set * by this method, along with any others required for proper up navigation as outlined * in the Android Design Guide. * * <p>This method should be used when performing up navigation from within the same task * as the destination. If up navigation should cross tasks in some cases, see * {@link #supportShouldUpRecreateTask(android.content.Intent)}.</p> * * @param upIntent An intent representing the target destination for up navigation */ public void supportNavigateUpTo(@NonNull Intent upIntent) { NavUtils.navigateUpTo(this, upIntent); }
@Override public boolean onOptionsItemSelected(MenuItem item){ int id = item.getItemId(); if(id == android.R.id.home){ NavUtils.navigateUpTo(this, new Intent(this, com.wada811.android.material.design.colors.sample.ItemListActivity.class)); return true; } return super.onOptionsItemSelected(item); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. // NavUtils allows users to navigate up one level in the // application structure. NavUtils.navigateUpTo(this, new Intent(this, MainActivity.class)); return true; } return super.onOptionsItemSelected(item); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpTo(this, new Intent(this, TaskListActivity.class)); return true; } return super.onOptionsItemSelected(item); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpTo(this, new Intent(this, ItemListActivity.class)); return true; } return super.onOptionsItemSelected(item); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent intent = NavUtils.getParentActivityIntent(this); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP); NavUtils.navigateUpTo(this, intent); return true; } return super.onOptionsItemSelected(item); } }
private void goToReturnActivity() { Class<? extends Activity> checkedReturnActivity = getReturnActivity(); Intent intent = new Intent(this, checkedReturnActivity); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); NavUtils.navigateUpTo(this, intent); }
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { NavUtils.navigateUpTo(this, new Intent(this, AppListActivity.class)); return true; } return super.onOptionsItemSelected(item); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent intent = NavUtils.getParentActivityIntent(this); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP); NavUtils.navigateUpTo(this, intent); return true; } return super.onOptionsItemSelected(item); } private void exibirHotelFragment(Hotel hotel) {
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent intent = NavUtils.getParentActivityIntent(this); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP); NavUtils.navigateUpTo(this, intent); return true; } return super.onOptionsItemSelected(item); } private void exibirHotelFragment(Hotel hotel) {
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent intent = NavUtils.getParentActivityIntent(this); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP); NavUtils.navigateUpTo(this, intent); return true; } return super.onOptionsItemSelected(item); } private void exibirHotelFragment(Hotel hotel) {
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent intent = NavUtils.getParentActivityIntent(this); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP); NavUtils.navigateUpTo(this, intent); return true; } return super.onOptionsItemSelected(item); } private void exibirHotelFragment(Hotel hotel) {
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent intent = NavUtils.getParentActivityIntent(this); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP); NavUtils.navigateUpTo(this, intent); return true; } return super.onOptionsItemSelected(item); } private void exibirHotelFragment(Hotel hotel) {
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpTo(this, new Intent(this, ItemListActivity.class)); return true; } return super.onOptionsItemSelected(item); }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent intent = NavUtils.getParentActivityIntent(getActivity()); intent.putExtra("carro", carro); NavUtils.navigateUpTo(getActivity(), intent); return true; } return super.onOptionsItemSelected(item); }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent intent = NavUtils.getParentActivityIntent(getActivity()); intent.putExtra("carro", carro); NavUtils.navigateUpTo(getActivity(), intent); return true; } return super.onOptionsItemSelected(item); } }