# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

# ViewTranslationCallback

`public interface ViewTranslationCallback`
``

android.view.translation.ViewTranslationCallback

Callback for handling the translated information show or hide in the `View`.

When the platform intelligence starts translation of an app's ui, the system will call `View#dispatchCreateViewTranslationRequest` to collect the `ViewTranslationRequest`s for translation purpose by traversing the hierarchy then send to translation service. After receiving the `ViewTranslationResponse`, the system will call `ViewTranslationCallback#onShowTranslation(View)` to show the translated information for the `View`.

## Summary

### Public methods
`abstract boolean` | `onClearTranslation(View view)` Called when the translation state is no longer needed.
`abstract boolean` | `onHideTranslation(View view)` Called when user wants to view the original content instead of the translated content.
`abstract boolean` | `onShowTranslation(View view)` Called when the translated text is ready to show or if the user has requested to reshow the translated content after hiding it.

## Public methods

### onClearTranslation

    public abstract boolean onClearTranslation (View view)

Called when the translation state is no longer needed. It should restore the original content and clear all saved states.

Parameters
`view` | `View`: This value cannot be `null`.

Returns
`boolean` | `true` if the View handles clearing the translation.

### onHideTranslation

    public abstract boolean onHideTranslation (View view)

Called when user wants to view the original content instead of the translated content. This method will not be called before `View#onViewTranslationResponse` or `View#onViewTranslationResponse`.

Parameters
`view` | `View`: This value cannot be `null`.

Returns
`boolean` | `true` if the View handles hiding the translation.

### onShowTranslation

    public abstract boolean onShowTranslation (View view)

Called when the translated text is ready to show or if the user has requested to reshow the translated content after hiding it.

The translated content can be obtained from `View#getViewTranslationResponse`. This method will not be called before `View#onViewTranslationResponse` or `View#onVirtualViewTranslationResponses`.

NOTE: It is possible the user changes text that causes a new `ViewTranslationResponse` returns to show the new translation. If you cache the `ViewTranslationResponse` here, you should remember to keep the cached value up to date.

NOTE: For TextView implementation, `ContentCaptureSession#notifyViewTextChanged` shouldn't be called with the translated text, simply calling setText() here will trigger the method. You should either override `View#onProvideContentCaptureStructure()` to report the original text instead of the translated text or use a different approach to display the translated text. See `View#onViewTranslationResponse` for how to get the translated information.

Parameters
`view` | `View`: This value cannot be `null`.

Returns
`boolean` | `true` if the View handles showing the translation.

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