ConversationActions.Message


public final class ConversationActions.Message


Represents a message in the conversation.

Summary

Nested types

This class is deprecated.

Use android.view.textclassifier.ConversationAction.Builder instead.

Constants

static final @NonNull Person

Represents the remote user.

static final @NonNull Person

Represents the local user.

Public methods

static @NonNull ConversationActions.Message

Converts a bundle that was created using toBundle to a ConversationActions.Message.

@NonNull Person

Returns the person that composed the message.

@NonNull Bundle

Returns the extended data related to this conversation action.

@Nullable Long

Returns the reference time of the message, for example it could be the compose or send time of this message.

@Nullable CharSequence

Returns the text of the message.

@NonNull Bundle

Adds this object to a Bundle that can be read back with the same parameters to createFromBundle.

Constants

PERSON_USER_OTHERS

public static final @NonNull Person PERSON_USER_OTHERS

Represents the remote user.

If possible, you are suggested to create a Person object that can identify the remote user better, so that the underlying model could differentiate between different remote users.

PERSON_USER_SELF

public static final @NonNull Person PERSON_USER_SELF

Represents the local user.

Public methods

createFromBundle

public static @NonNull ConversationActions.Message createFromBundle(@NonNull Bundle bundle)

Converts a bundle that was created using toBundle to a ConversationActions.Message.

getAuthor

public @NonNull Person getAuthor()

Returns the person that composed the message.

getExtras

public @NonNull 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.

getReferenceTime

public @Nullable Long getReferenceTime()

Returns the reference time of the message, for example it could be the compose or send time of this message. This should be milliseconds from the epoch of 1970-01-01T00:00:00Z(UTC timezone). If no reference time or null is set, now is used.

getText

public @Nullable CharSequence getText()

Returns the text of the message.

toBundle

public @NonNull Bundle toBundle()

Adds this object to a Bundle that can be read back with the same parameters to createFromBundle.