TranslationResponseValue.Builder


public static final class TranslationResponseValue.Builder
extends Object

java.lang.Object
   ↳ android.view.translation.TranslationResponseValue.Builder


A builder for TranslationResponseValue

Summary

Public constructors

Builder(int statusCode)

Creates a new Builder.

Public methods

TranslationResponseValue build()

Builds the instance.

TranslationResponseValue.Builder setExtras(Bundle value)

Extra results associated with the translated text.

TranslationResponseValue.Builder setText(CharSequence value)

The translated text result.

TranslationResponseValue.Builder setTransliteration(CharSequence value)

The transliteration result of the translated text.

Inherited methods

Public constructors

Builder

Added in API level 31
public Builder (int statusCode)

Creates a new Builder.

Parameters
statusCode int: The status code of this TranslationResponseValue.

If the status code is TranslationResponseValue.STATUS_ERROR, no values are attached, and all getters will return null. Value is TranslationResponseValue.STATUS_SUCCESS, or TranslationResponseValue.STATUS_ERROR

Public methods

build

Added in API level 31
public TranslationResponseValue build ()

Builds the instance. This builder should not be touched after calling this!

Returns
TranslationResponseValue This value cannot be null.

setExtras

Added in API level 31
public TranslationResponseValue.Builder setExtras (Bundle value)

Extra results associated with the translated text.

The bundle includes TranslationResponseValue.EXTRA_DEFINITIONS, obtained by Bundle#getBundle.

Parameters
value Bundle: This value cannot be null.

Returns
TranslationResponseValue.Builder This value cannot be null.

setText

Added in API level 31
public TranslationResponseValue.Builder setText (CharSequence value)

The translated text result.

Parameters
value CharSequence: This value cannot be null.

Returns
TranslationResponseValue.Builder This value cannot be null.

setTransliteration

Added in API level 31
public TranslationResponseValue.Builder setTransliteration (CharSequence value)

The transliteration result of the translated text.

This returns a CharSequence representation of the transliteration of the translated text.

Parameters
value CharSequence: This value cannot be null.

Returns
TranslationResponseValue.Builder This value cannot be null.