ConversationAction


public final class ConversationAction
extends Object implements Parcelable

java.lang.Object
   ↳ android.view.textclassifier.ConversationAction


Represents the action suggested by a TextClassifier on a given conversation.

Summary

Nested classes

class ConversationAction.Builder

Builder class to construct ConversationAction

Constants

String TYPE_CALL_PHONE

Indicates an action to call a phone number.

String TYPE_CREATE_REMINDER

Indicates an action to create a reminder.

String TYPE_OPEN_URL

Indicates an action to open an URL.

String TYPE_SEND_EMAIL

Indicates an action to send an email.

String TYPE_SEND_SMS

Indicates an action to send a SMS.

String TYPE_SHARE_LOCATION

Indicates an action to reply with a location.

String TYPE_TEXT_REPLY

Indicates an action to reply with a text message.

String TYPE_TRACK_FLIGHT

Indicates an action to track a flight.

String TYPE_VIEW_CALENDAR

Indicates an action to view a calendar at a specified time.

String TYPE_VIEW_MAP

Indicates an action to view the map at a specified location.

Inherited constants

Fields

public static final Creator<ConversationAction> CREATOR

Public methods

int describeContents()

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

RemoteAction getAction()

Returns a RemoteAction object, which contains the icon, label and a PendingIntent, for the specified action type.

float getConfidenceScore()

Returns the confidence score for the specified action.

Bundle getExtras()

Returns the extended data related to this conversation action.

CharSequence getTextReply()

Returns the text reply that could be sent as a reply to the given conversation.

String getType()

Returns the type of this action, for example, TYPE_VIEW_CALENDAR.

void writeToParcel(Parcel parcel, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

TYPE_CALL_PHONE

Added in API level 29
public static final String TYPE_CALL_PHONE

Indicates an action to call a phone number.

Constant Value: "call_phone"

TYPE_CREATE_REMINDER

Added in API level 29
public static final String TYPE_CREATE_REMINDER

Indicates an action to create a reminder.

Constant Value: "create_reminder"

TYPE_OPEN_URL

Added in API level 29
public static final String TYPE_OPEN_URL

Indicates an action to open an URL.

Constant Value: "open_url"

TYPE_SEND_EMAIL

Added in API level 29
public static final String TYPE_SEND_EMAIL

Indicates an action to send an email.

Constant Value: "send_email"

TYPE_SEND_SMS

Added in API level 29
public static final String TYPE_SEND_SMS

Indicates an action to send a SMS.

Constant Value: "send_sms"

TYPE_SHARE_LOCATION

Added in API level 29
public static final String TYPE_SHARE_LOCATION

Indicates an action to reply with a location.

Constant Value: "share_location"

TYPE_TEXT_REPLY

Added in API level 29
public static final String TYPE_TEXT_REPLY

Indicates an action to reply with a text message.

Constant Value: "text_reply"

TYPE_TRACK_FLIGHT

Added in API level 29
public static final String TYPE_TRACK_FLIGHT

Indicates an action to track a flight.

Constant Value: "track_flight"

TYPE_VIEW_CALENDAR

Added in API level 29
public static final String TYPE_VIEW_CALENDAR

Indicates an action to view a calendar at a specified time.

Constant Value: "view_calendar"

TYPE_VIEW_MAP

Added in API level 29
public static final String TYPE_VIEW_MAP

Indicates an action to view the map at a specified location.

Constant Value: "view_map"

Fields

CREATOR

Added in API level 29
public static final Creator<ConversationAction> CREATOR

Public methods

describeContents

Added in API level 29
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

getAction

Added in API level 29
public RemoteAction getAction ()

Returns a RemoteAction object, which contains the icon, label and a PendingIntent, for the specified action type.

Returns
RemoteAction This value may be null.

getConfidenceScore

Added in API level 29
public float getConfidenceScore ()

Returns the confidence score for the specified action. The value ranges from 0 (low confidence) to 1 (high confidence).

Returns
float Value is between 0 and 1 inclusive

getExtras

Added in API level 29
public Bundle getExtras ()

Returns the extended data related to this conversation action.

NOTE: Do not modify this bundle.

Returns
Bundle This value cannot be null.

getTextReply

Added in API level 29
public CharSequence getTextReply ()

Returns the text reply that could be sent as a reply to the given conversation.

This is only available when the type of the action is TYPE_TEXT_REPLY.

Returns
CharSequence This value may be null.

getType

Added in API level 29
public String getType ()

Returns the type of this action, for example, TYPE_VIEW_CALENDAR.

Returns
String This value cannot be null. Value is TYPE_VIEW_CALENDAR, TYPE_VIEW_MAP, TYPE_TRACK_FLIGHT, TYPE_OPEN_URL, TYPE_SEND_SMS, TYPE_CALL_PHONE, TYPE_SEND_EMAIL, TYPE_TEXT_REPLY, TYPE_CREATE_REMINDER, or TYPE_SHARE_LOCATION

writeToParcel

Added in API level 29
public void writeToParcel (Parcel parcel, 
                int flags)

Flatten this object in to a Parcel.

Parameters
parcel Parcel: The Parcel in which the object should be written. 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