共用方式為


Activity.OnTopResumedActivityChanged(Boolean) Method

Definition

Called when activity gets or loses the top resumed position in the system.

[Android.Runtime.Register("onTopResumedActivityChanged", "(Z)V", "GetOnTopResumedActivityChanged_ZHandler", ApiSince=29)]
public virtual void OnTopResumedActivityChanged (bool isTopResumedActivity);
[<Android.Runtime.Register("onTopResumedActivityChanged", "(Z)V", "GetOnTopResumedActivityChanged_ZHandler", ApiSince=29)>]
abstract member OnTopResumedActivityChanged : bool -> unit
override this.OnTopResumedActivityChanged : bool -> unit

Parameters

isTopResumedActivity
Boolean

true if it's the topmost resumed activity in the system, false otherwise. A call with this as true will always be followed by another one with false.

Attributes

Remarks

Called when activity gets or loses the top resumed position in the system.

Starting with android.os.Build.VERSION_CODES#Q multiple activities can be resumed at the same time in multi-window and multi-display modes. This callback should be used instead of #onResume() as an indication that the activity can try to open exclusive-access devices like camera.

It will always be delivered after the activity was resumed and before it is paused. In some cases it might be skipped and activity can go straight from #onResume() to #onPause() without receiving the top resumed state.

Java documentation for android.app.Activity.onTopResumedActivityChanged(boolean).

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