Freigeben über


Activity.OnResume Method

Definition

Called after #onRestoreInstanceState, #onRestart, or #onPause.

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

Remarks

Called after #onRestoreInstanceState, #onRestart, or #onPause. This is usually a hint for your activity to start interacting with the user, which is a good indicator that the activity became active and ready to receive input. This sometimes could also be a transit state toward another resting state. For instance, an activity may be relaunched to #onPause due to configuration changes and the activity was visible, but wasn’t the top-most activity of an activity task. #onResume is guaranteed to be called before #onPause in this case which honors the activity lifecycle policy and the activity eventually rests in #onPause.

On platform versions prior to android.os.Build.VERSION_CODES#Q this is also a good place to try to open exclusive-access devices or to get access to singleton resources. Starting with android.os.Build.VERSION_CODES#Q there can be multiple resumed activities in the system simultaneously, so #onTopResumedActivityChanged(boolean) should be used for that purpose instead.

<em>Derived classes must call through to the super class's implementation of this method. If they do not, an exception will be thrown.</em>

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

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