The Developer Preview for Android 11 is now available; test it out and share your feedback.

Message

class Message
kotlin.Any
   ↳ androidx.textclassifier.ConversationActions.Message

Represents a message in the conversation.

Summary

Nested classes

Builder class to construct a Message

Public methods

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

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

Person

Returns the person that composed the message.

Bundle

Returns the extended data related to this conversation action.

Long?

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

CharSequence?

Returns the text of the message.

Bundle

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

Properties

static Person

Represents the remote user.

static Person

Represents the local user.

Public methods

createFromBundle

@NonNull static fun createFromBundle(@NonNull bundle: Bundle): ConversationActions.Message

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

getAuthor

@NonNull fun getAuthor(): Person

Returns the person that composed the message.

getExtras

@NonNull fun getExtras(): Bundle

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

@Nullable fun getReferenceTime(): Long?

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

@Nullable fun getText(): CharSequence?

Returns the text of the message.

toBundle

@NonNull fun toBundle(): Bundle

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

Properties

PERSON_USER_OTHERS

@NonNull static val PERSON_USER_OTHERS: Person

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

@NonNull static val PERSON_USER_SELF: Person

Represents the local user.