Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Message

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/view/textclassifier/ConversationActions.Message "View this page in Java")

```
class Message : Parcelable
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.view.textclassifier.ConversationActions.Message](https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#) |

Represents a message in the conversation.

## Summary

| Nested classes ||
|---|---|
|   | `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message.Builder` Builder class to construct a `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#` |

| Inherited constants ||
|---|---|
| From class `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#` |---|---| | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int` Descriptor bit used with `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int` Flag for use with `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". Some implementations may want to release resources at this point. <br /> | ||

| Public methods ||
|---|---|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#describeContents()()` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| [Person](https://developer.android.com/reference/kotlin/android/app/Person.html#) | `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#getAuthor()()` Returns the person that composed the message. |
| [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#) | `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#getExtras()()` Returns the extended data related to this conversation action. |
| [ZonedDateTime](https://developer.android.com/reference/kotlin/java/time/ZonedDateTime.html#)? | `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#getReferenceTime()()` Returns the reference time of the message, for example it could be the compose or send time of this message. |
| [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)? | `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#getText()()` Returns the text of the message. |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#writeToParcel(android.os.Parcel,%20kotlin.Int)(parcel: https://developer.android.com/reference/kotlin/android/os/Parcel.html#, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Flatten this object in to a Parcel. |

| Properties ||
|---|---|
| static [Parcelable.Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator.html#)\<[ConversationActions.Message](https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#)!\> | `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#CREATOR:android.os.Parcelable.Creator` <br /> |
| static [Person](https://developer.android.com/reference/kotlin/android/app/Person.html#) | `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#PERSON_USER_OTHERS:android.app.Person` Represents the remote user. |
| static [Person](https://developer.android.com/reference/kotlin/android/app/Person.html#) | `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message#PERSON_USER_SELF:android.app.Person` Represents the local user. |

## Public methods

### describeContents

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun describeContents(): Int
```

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 `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)`, the return value of this method must include the `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int` bit.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int` |

### getAuthor

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getAuthor(): Person
```

Returns the person that composed the message.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Person.html#` | This value cannot be `null`. |

### getExtras

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getExtras(): Bundle
```

Returns the extended data related to this conversation action.

**NOTE:**Do not modify this bundle.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` | This value cannot be `null`. |

### getReferenceTime

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getReferenceTime(): ZonedDateTime?
```

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/java/time/ZonedDateTime.html#?` | This value may be `null`. |

### getText

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getText(): CharSequence?
```

Returns the text of the message.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html?` | This value may be `null`. |

### writeToParcel

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun writeToParcel(
    parcel: Parcel, 
    flags: Int
): Unit
```

Flatten this object in to a Parcel.

| Parameters ||
|---|---|
| `dest` | The Parcel in which the object should be written. This value cannot be `null`. |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int` |

## Properties

### CREATOR

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CREATOR: Parcelable.Creator<ConversationActions.Message!>
```

### PERSON_USER_OTHERS

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PERSON_USER_OTHERS: Person
```

Represents the remote user.

If possible, you are suggested to create a `https://developer.android.com/reference/kotlin/android/app/Person.html#` object that can identify the remote user better, so that the underlying model could differentiate between different remote users.
**See Also**

- `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message.Builder#Builder(android.app.Person)`

### PERSON_USER_SELF

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val PERSON_USER_SELF: Person
```

Represents the local user.
**See Also**

- `https://developer.android.com/reference/kotlin/android/view/textclassifier/ConversationActions.Message.Builder#Builder(android.app.Person)`