What's New

Implement a simple chat bubble with a button

Let's say you want to implement a simple chat bubble like this, with RecyclerView ViewType and Kotlin:

  1. When sending a message, fill in the key-value data in 'metaData' property which will be used for creating an UIView instance.

circle-info

You can enter up to 5 key-value pairs in data field. The maximum size of key is 128 characters and the maximum size of value is 1024 characters. Both key and value must be strings.

  1. Define a 'CardViewMessageModel' data class that contains data to be displayed on the screen.

  1. Add a ViewType to RecyclerView Adapter class.

  1. 'messageReceived' method will be called whenever receiving a new message. At this method, call 'getData' method in 'TPMessage to get key-value data and then create an instance of 'CardViewMessageModel'.

Last updated