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  | 
| Inherited methods | |
|---|---|
Public methods
isDestroyed
public boolean isDestroyed ()
Returns whether or not this Translator has been destroyed.
| Returns | |
|---|---|
| boolean | |
See also:
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:TranslationRequestrequest to be translate.
 This value cannot benull. | 
| cancellationSignal | CancellationSignal: signal to cancel the operation in progress.
 This value may benull. | 
| executor | Executor: Executor to run callback operations
 This value cannot benull.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread. | 
| callback | Consumer:Consumerto receive the translation response. Multiple responses may
                 be received ifTranslationRequest.FLAG_PARTIAL_RESPONSESis set.
 This value cannot benull. | 
| Returns | |
|---|---|
| void | This value may be null. | 
| Throws | |
|---|---|
| IllegalStateException | if this Translator session was destroyed when called. | 
