ConversationAction
public
final
class
ConversationAction
extends Object
java.lang.Object | |
↳ | androidx.textclassifier.ConversationAction |
Represents an action suggested by a TextClassifier
on a given conversation.
Summary
Nested classes | |
---|---|
class |
ConversationAction.Builder
Builder class to construct |
Constants | |
---|---|
String |
TYPE_ADD_CONTACT
Indicates an action to add a contact. |
String |
TYPE_CALL_PHONE
Indicates an action to call a phone number. |
String |
TYPE_COPY
Indicates an action to copy a code. |
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. |
Public methods | |
---|---|
static
ConversationAction
|
createFromBundle(Bundle bundle)
Converts a bundle that was created using |
RemoteActionCompat
|
getAction()
Returns a RemoteActionCompat 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, |
Bundle
|
toBundle()
Adds this object to a Bundle that can be read back with the same parameters
to |
Inherited methods | |
---|---|
Constants
TYPE_ADD_CONTACT
public static final String TYPE_ADD_CONTACT
Indicates an action to add a contact.
Constant Value: "add_contact"
TYPE_CALL_PHONE
public static final String TYPE_CALL_PHONE
Indicates an action to call a phone number.
Constant Value: "call_phone"
TYPE_COPY
public static final String TYPE_COPY
Indicates an action to copy a code.
Constant Value: "copy"
TYPE_CREATE_REMINDER
public static final String TYPE_CREATE_REMINDER
Indicates an action to create a reminder.
Constant Value: "create_reminder"
TYPE_OPEN_URL
public static final String TYPE_OPEN_URL
Indicates an action to open an URL.
Constant Value: "open_url"
TYPE_SEND_EMAIL
public static final String TYPE_SEND_EMAIL
Indicates an action to send an email.
Constant Value: "send_email"
TYPE_SEND_SMS
public static final String TYPE_SEND_SMS
Indicates an action to send a SMS.
Constant Value: "send_sms"
TYPE_SHARE_LOCATION
public static final String TYPE_SHARE_LOCATION
Indicates an action to reply with a location.
Constant Value: "share_location"
TYPE_TEXT_REPLY
public static final String TYPE_TEXT_REPLY
Indicates an action to reply with a text message.
Constant Value: "text_reply"
TYPE_TRACK_FLIGHT
public static final String TYPE_TRACK_FLIGHT
Indicates an action to track a flight.
Constant Value: "track_flight"
TYPE_VIEW_CALENDAR
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
public static final String TYPE_VIEW_MAP
Indicates an action to view the map at a specified location.
Constant Value: "view_map"
Public methods
createFromBundle
public static ConversationAction createFromBundle (Bundle bundle)
Converts a bundle that was created using toBundle()
to a ConversationAction
.
Parameters | |
---|---|
bundle |
Bundle |
Returns | |
---|---|
ConversationAction |
getAction
public RemoteActionCompat getAction ()
Returns a RemoteActionCompat object, which contains the icon, label and a PendingIntent, for the specified action type.
Returns | |
---|---|
RemoteActionCompat |
getConfidenceScore
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.0 and 1.0 inclusive. |
getExtras
public Bundle getExtras ()
Returns the extended data related to this conversation action.
NOTE: Each call to this method returns a new bundle copy so clients should prefer to hold a reference to the returned bundle rather than frequently calling this method.
Returns | |
---|---|
Bundle |
getTextReply
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 |
getType
public String getType ()
Returns the type of this action, for example, TYPE_VIEW_CALENDAR
.
Returns | |
---|---|
String |
toBundle
public Bundle toBundle ()
Adds this object to a Bundle that can be read back with the same parameters
to createFromBundle(Bundle)
.
Returns | |
---|---|
Bundle |
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-30 UTC.