Udostępnij za pośrednictwem


IWindowManager.AddProposedRotationListener(IExecutor, IIntConsumer) Method

Definition

Adds a listener to start monitoring the proposed rotation of the current associated context.

[Android.Runtime.Register("addProposedRotationListener", "(Ljava/util/concurrent/Executor;Ljava/util/function/IntConsumer;)V", "GetAddProposedRotationListener_Ljava_util_concurrent_Executor_Ljava_util_function_IntConsumer_Handler:Android.Views.IWindowManager, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=34)]
public virtual void AddProposedRotationListener (Java.Util.Concurrent.IExecutor executor, Java.Util.Functions.IIntConsumer listener);
[<Android.Runtime.Register("addProposedRotationListener", "(Ljava/util/concurrent/Executor;Ljava/util/function/IntConsumer;)V", "GetAddProposedRotationListener_Ljava_util_concurrent_Executor_Ljava_util_function_IntConsumer_Handler:Android.Views.IWindowManager, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=34)>]
abstract member AddProposedRotationListener : Java.Util.Concurrent.IExecutor * Java.Util.Functions.IIntConsumer -> unit
override this.AddProposedRotationListener : Java.Util.Concurrent.IExecutor * Java.Util.Functions.IIntConsumer -> unit

Parameters

executor
IExecutor

The executor on which callback method will be invoked.

listener
IIntConsumer

Called when the proposed rotation for the context is being delivered. The reported rotation can be Surface#ROTATION_0, Surface#ROTATION_90, Surface#ROTATION_180 and Surface#ROTATION_270.

Attributes

Remarks

Adds a listener to start monitoring the proposed rotation of the current associated context. It reports the current recommendation for the rotation that takes various factors (e.g. sensor, context, device state, etc) into account. The proposed rotation might not be applied by the system automatically due to the application's active preference to lock the orientation (e.g. with android.app.Activity#setRequestedOrientation(int)). This listener gives application an opportunity to selectively react to device orientation changes. The newly added listener will be called with current proposed rotation. Note that the context of this window manager instance must be a android.annotation.UiContext.

Java documentation for android.view.WindowManager.addProposedRotationListener(java.util.concurrent.Executor, java.util.function.IntConsumer).

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