Share via


Activity.OnUserLeaveHint Method

Definition

Called as part of the activity lifecycle when an activity is about to go into the background as the result of user choice.

[Android.Runtime.Register("onUserLeaveHint", "()V", "GetOnUserLeaveHintHandler")]
protected virtual void OnUserLeaveHint ();
[<Android.Runtime.Register("onUserLeaveHint", "()V", "GetOnUserLeaveHintHandler")>]
abstract member OnUserLeaveHint : unit -> unit
override this.OnUserLeaveHint : unit -> unit
Attributes

Remarks

Called as part of the activity lifecycle when an activity is about to go into the background as the result of user choice. For example, when the user presses the Home key, #onUserLeaveHint will be called, but when an incoming phone call causes the in-call Activity to be automatically brought to the foreground, #onUserLeaveHint will not be called on the activity being interrupted. In cases when it is invoked, this method is called right before the activity's #onPause callback.

This callback and #onUserInteraction are intended to help activities manage status bar notifications intelligently; specifically, for helping activities determine the proper time to cancel a notification.

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

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

See also