TranslationResponse
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.
Summary
Nested classes | |
|---|---|
class |
TranslationResponse.Builder
A builder for |
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 | |
|---|---|
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 translation service was successful in translating.
Constant Value: 0 (0x00000000)
TRANSLATION_STATUS_UNKNOWN_ERROR
public static final int TRANSLATION_STATUS_UNKNOWN_ERROR
The translation service returned unknown translation result.
Constant Value: 1 (0x00000001)
Fields
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.
| 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 |
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 2025-02-10 UTC.