Android.App.Activity.OnPause Method
Called as part of the activity lifecycle when an activity is going into the background, but has not (yet) been killed.

Syntax

[Android.Runtime.Register("onPause", "()V", "GetOnPauseHandler")]
protected virtual void OnPause ()

See Also

Activity.OnResume
Activity.OnSaveInstanceState(Android.OS.Bundle)
Activity.OnStop

Remarks

Called as part of the activity lifecycle when an activity is going into the background, but has not (yet) been killed. The counterpart to Activity.OnResume.

When activity B is launched in front of activity A, this callback will be invoked on A. B will not be created until A's Activity.OnPause returns, so be sure to not do anything lengthy here.

This callback is mostly used for saving any persistent state the activity is editing, to present a "edit in place" model to the user and making sure nothing is lost if there are not enough resources to start the new activity without first killing this one. This is also a good place to do things like stop animations and other things that consume a noticeable amount of CPU in order to make the switch to the next activity as fast as possible, or to close resources that are exclusive access such as the camera.

In situations where the system needs more memory it may kill paused processes to reclaim resources. Because of this, you should be sure that all of your state is saved by the time you return from this function. In general Activity.OnSaveInstanceState(Android.OS.Bundle) is used to save per-instance state in the activity and this method is used to store global persistent data (in content providers, files, etc.)

After receiving this call you will usually receive a following call to Activity.OnStop (after the next activity has been resumed and displayed), however in some cases there will be a direct call back to Activity.OnResume without going through the stopped state.

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

[Android Documentation]

Requirements

Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1