# Print output for @column tags ?> UiTranslationManager - Android SDK | Android Developers

Most visited

Recently visited

UiTranslationManager

public final class UiTranslationManager
extends Object

java.lang.Object
   ↳ android.view.translation.UiTranslationManager


The UiTranslationManager class provides ways for apps to use the ui translation function in framework.

Summary

Public methods

void registerUiTranslationStateCallback(Executor executor, UiTranslationStateCallback callback)

Register for notifications of UI Translation state changes on the foreground activity.

void unregisterUiTranslationStateCallback(UiTranslationStateCallback callback)

Unregister callback.

Inherited methods

Public methods

registerUiTranslationStateCallback

public void registerUiTranslationStateCallback (Executor executor, 
                UiTranslationStateCallback callback)

Register for notifications of UI Translation state changes on the foreground activity. This is available to the owning application itself and also the current input method.

The application whose UI is being translated can use this to customize the UI Translation behavior in ways that aren't made easy by methods like View#onCreateTranslationRequest().

Input methods can use this to offer complementary features to UI Translation; for example, enabling outgoing message translation when the system is translating incoming messages in a communication app.

Parameters
executor Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). To dispatch events through a shared thread pool, you can use AsyncTask#THREAD_POOL_EXECUTOR.

callback UiTranslationStateCallback: the callback to register for receiving the state change notifications This value cannot be null.

unregisterUiTranslationStateCallback

public void unregisterUiTranslationStateCallback (UiTranslationStateCallback callback)

Unregister callback.

Parameters
callback UiTranslationStateCallback: This value cannot be null.

See also: