Compartilhar via


Activity.OnNavigateUp Method

Definition

This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar.

[Android.Runtime.Register("onNavigateUp", "()Z", "GetOnNavigateUpHandler")]
public virtual bool OnNavigateUp ();
[<Android.Runtime.Register("onNavigateUp", "()Z", "GetOnNavigateUpHandler")>]
abstract member OnNavigateUp : unit -> bool
override this.OnNavigateUp : unit -> bool

Returns

true if Up navigation completed successfully and this Activity was finished, false otherwise.

Attributes

Remarks

This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar.

If the attribute android.R.attr#parentActivityName parentActivityName was specified in the manifest for this activity or an activity-alias to it, default Up navigation will be handled automatically. If any activity along the parent chain requires extra Intent arguments, the Activity subclass should override the method #onPrepareNavigateUpTaskStack(TaskStackBuilder) to supply those arguments.

See Tasks and Back Stack from the developer guide and Navigation from the design guide for more information about navigating within your app.

See the TaskStackBuilder class and the Activity methods #getParentActivityIntent(), #shouldUpRecreateTask(Intent), and #navigateUpTo(Intent) for help implementing custom Up navigation. The AppNavigation sample application in the Android SDK is also available for reference.

Java documentation for android.app.Activity.onNavigateUp().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to