# Print output for @column tags ?>
public
class
Translator
extends Object
| java.lang.Object | |
| ↳ | android.view.translation.Translator |
The Translator for translation, defined by a TranslationContext.
Public methods | |
|---|---|
void
|
destroy()
Destroy this Translator. |
boolean
|
isDestroyed()
Returns whether or not this Translator has been destroyed. |
void
|
translate(TranslationRequest request, CancellationSignal cancellationSignal, Executor executor, Consumer<TranslationResponse> callback)
Requests a translation for the provided |
Inherited methods | |
|---|---|
public void destroy ()
Destroy this Translator.
public boolean isDestroyed ()
Returns whether or not this Translator has been destroyed.
| Returns | |
|---|---|
boolean |
|
See also:
public void translate (TranslationRequest request, CancellationSignal cancellationSignal, Executor executor, Consumer<TranslationResponse> callback)
Requests a translation for the provided TranslationRequest using the Translator's
source spec and destination spec.
| Parameters | |
|---|---|
request |
TranslationRequest: TranslationRequest request to be translate.
This value cannot be null. |
cancellationSignal |
CancellationSignal: signal to cancel the operation in progress.
This value may be null. |
executor |
Executor: Executor to run callback operations
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 |
Consumer: Consumer to receive the translation response. Multiple responses may
be received if TranslationRequest#FLAG_PARTIAL_RESPONSES is set.
This value cannot be null. |
| Returns | |
|---|---|
void |
This value may be null. |
| Throws | |
|---|---|
IllegalStateException |
if this Translator session was destroyed when called. |