# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Methods | Inherited Methods

# Translator

`public class Translator`
`extends Object` ``

java.lang.Object
↳ | android.view.translation.Translator

The `Translator` for translation, defined by a `TranslationContext`.

## Summary

### 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 `TranslationRequest` using the Translator's source spec and destination spec.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public methods

### destroy

    public void destroy ()

Destroy this Translator.

### isDestroyed

    public boolean isDestroyed ()

Returns whether or not this Translator has been destroyed.

Returns
`boolean` |

See also:

- `destroy()`

### translate

    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.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*