public
final
class
TranslationResponse
extends Object
implements
Parcelable
| java.lang.Object | |
| ↳ | android.view.translation.TranslationResponse |
Response from the translation service, which contains the translated result.
classTranslationResponse.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 translation service was successful in translating. |
int |
TRANSLATION_STATUS_UNKNOWN_ERROR
The translation service 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 |
int
|
getTranslationStatus()
The translation result status code. |
SparseArray<ViewTranslationResponse>
|
getViewTranslationResponses()
List of translated |
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 | |
|---|---|
public static final int TRANSLATION_STATUS_CONTEXT_UNSUPPORTED
The languages of the request is not available to be translated.
Constant Value: 2 (0x00000002)
public static final int TRANSLATION_STATUS_SUCCESS
The translation service was successful in translating.
Constant Value: 0 (0x00000000)
public static final int TRANSLATION_STATUS_UNKNOWN_ERROR
The translation service returned unknown translation result.
Constant Value: 1 (0x00000001)
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(Parcel,int),
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR bit.
int0 or
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. |
public int getTranslationStatus ()
The translation result status code.
intpublic 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. |
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 |
|
public String toString ()
Returns a string representation of the object.
| Returns | |
|---|---|
String |
a string representation of the object. |
public void writeToParcel (Parcel dest,
int flags)Flatten this object in to a Parcel.
destParcel: This value cannot be null.flagsint: Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.
0 or a combination of the following:
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-02-26 UTC.