/ UIKit / Android
Chat UIKit Android v3
Chat UIKit Android
Chat UIKit
Version 3

Reply to messages

Copy link

Members of a group or supergroup channel can reply to each others' messages in a thread using MessageThreadActivity or MessageThreadFragment. When a user taps Reply in thread in the Message menu of a user or file message in the group channel screen, the thread screen appears. In the new thread, users can start a separate conversation in response to the parent message.

Note : Threads is currently a beta feature that's still undergoing testing and development for improvement. Some inadvertent issues may arise while implementing this key function. If you encounter any bugs or if you have any helpful feedback, contact our support team.

Message thread screen

Copy link

A message thread screen is composed of four components: message thread header, thread list, message thread input, and thread list status.

Message thread header

Copy link

The message thread header component shows the title of the message thread screen, which says Thread by default. There's also a button on the left corner of the component, which when tapped, the finish() method of the activity is called to exit the current screen. Below the title, there’s a text button that indicates the name of the channel that the thread belongs to. When a user taps on the button, they can view the corresponding parent message in the group channel screen. The view of the thread header is created and customized in MessageThreadHeaderComponent of MessageThreadModule.

Thread list

Copy link

The thread list component shows the parent message and a list of all its replies, both text and file messages, in a chronological order. Replies sent by the current user are differentiated from those sent by other channel members by the color and location of the message bubble. The view of the thread list is created and customized in ThreadListComponent of MessageThreadModule.

Message thread input

Copy link

The message thread input component is where the user can send either a text or file message as a reply to the parent message in the thread. The placeholder text in the message input field changes depending on whether the parent message has an existing thread or not. If the parent message already has one or more thread replies, the default placeholder text is Reply to thread. If the parent message has no existing replies, the placeholder text is Reply in thread. The view of the message thread input is created and customized in MessageThreadInputComponent of MessageThreadModule.

Thread list status

Copy link

The thread list status component shows the result of the data request for a thread list. The StatusComponent exists in MessageThreadModule and lets the user know if the list is loading or if the list couldn’t be called.

UIKit for Android provides both activity and fragment to create a message thread screen. You can choose which one to build your app with and you may solely use activity instead of fragment if you wish to. You can build a message thread screen through MessageThreadActivity, which uses UIKitFragmentFactory to create views.

Start an activity

Copy link

You can start an activity by using intent to move from one activity to MessageThreadActivity as shown below:

val intent = MessageThreadActivity
            .IntentBuilder(context, "channel_url", parentMessage)

Create a fragment

Copy link

The MessageThreadActivity allows you to create a basic MessageThreadFragment through UIKitFragmentFactory and MessageThreadFragment.Builder. The UIKitFragmentFactory has a set of methods that build each fragment, whereas the builder class provides APIs to customize the UI of the data and event handlers used in MessageThreadFragment. To see all APIs of MessageThreadFragment.Builder, refer to the API reference page.

val fragment = MessageThreadFragment.Builder("channel_url", parentMessage).build()

Note: To use UIKit's fragments as a nested fragment, refer to the Android Developer Documentation's Nested Fragments.


Copy link

In the reply to messages key function, you can customize MessageThreadFragment to change different parts of the screen. The MessageThreadFragment.Builder class allows you to create and customize the basic MessageThreadFragment that UIKit provides but you can only change its own APIs, such as setting a layout. If you wish to customize the fragment beyond using the APIs provided in the builder, you must inherit new customization methods.

The following table shows the main classes used in MessageThreadFragment to display and customize the message thread screen.










Depending on the UI or the feature you wish to customize in the fragment, you can change the classes mentioned in the table. To learn how to customize the fragment, see the Customizations overview page for further details.

Note: The links to the above customization pages provide an example of how to customize classes related to ChannelFragment. In order to make changes to the message thread screen, you must use the correct classes.