# Print output for @column tags ?> TranslationResponse - Android SDK | Android Developers

Most visited

Recently visited

TranslationResponse

public final class TranslationResponse
extends Object implements Parcelable

java.lang.Object
   ↳ android.view.translation.TranslationResponse


Response from the TranslationService, which contains the translated result.

Summary

Nested classes

class TranslationResponse.Builder

A builder for TranslationResponse 

Constants

int TRANSLATION_STATUS_CONTEXT_UNSUPPORTED

The languages of the request is not available to be translated.

int TRANSLATION_STATUS_SUCCESS

The TranslationService was successful in translating.

int TRANSLATION_STATUS_UNKNOWN_ERROR

The TranslationService returned unknown translation result.

Inherited constants

Fields

public static final Creator<TranslationResponse> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

SparseArray<TranslationResponseValue> getTranslationResponseValues()

List of translated TranslationResponseValues.

int getTranslationStatus()

The translation result status code.

SparseArray<ViewTranslationResponse> getViewTranslationResponses()

List of translated ViewTranslationResponses.

boolean isFinalResponse()

Whether this response contains complete translated values, or is the final response in a series of partial responses.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

TRANSLATION_STATUS_CONTEXT_UNSUPPORTED

public static final int TRANSLATION_STATUS_CONTEXT_UNSUPPORTED

The languages of the request is not available to be translated.

Constant Value: 2 (0x00000002)

TRANSLATION_STATUS_SUCCESS

public static final int TRANSLATION_STATUS_SUCCESS

The TranslationService was successful in translating.

Constant Value: 0 (0x00000000)

TRANSLATION_STATUS_UNKNOWN_ERROR

public static final int TRANSLATION_STATUS_UNKNOWN_ERROR

The TranslationService returned unknown translation result.

Constant Value: 1 (0x00000001)

Fields

CREATOR

public static final Creator<TranslationResponse> CREATOR

Public methods

describeContents

public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

getTranslationResponseValues

public SparseArray<TranslationResponseValue> getTranslationResponseValues ()

List of translated TranslationResponseValues. The key of entries in this list will be their respective index in TranslationRequest#getTranslationRequestValues().

Returns
SparseArray<TranslationResponseValue> This value cannot be null.

getTranslationStatus

public int getTranslationStatus ()

The translation result status code.

Returns
int Value is TRANSLATION_STATUS_SUCCESS, TRANSLATION_STATUS_UNKNOWN_ERROR, or TRANSLATION_STATUS_CONTEXT_UNSUPPORTED

getViewTranslationResponses

public SparseArray<ViewTranslationResponse> getViewTranslationResponses ()

List of translated ViewTranslationResponses. The key of entries in this list will be their respective index in TranslationRequest#getViewTranslationRequests().

Returns
SparseArray<ViewTranslationResponse> This value cannot be null.

isFinalResponse

public boolean isFinalResponse ()

Whether this response contains complete translated values, or is the final response in a series of partial responses.

This is true by default.

Returns
boolean

toString

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

writeToParcel

public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES