Skip to main content
CometChatThreadHeader renders the parent message bubble and reply count for a threaded conversation. It requires a parent message to display.

Where It Fits

CometChatThreadHeader is a header component for threaded message views. Wire it above a CometChatMessageList and CometChatMessageComposer to build a complete threaded conversation layout.
activity_thread.xml

Quick Start

Add to your layout XML:
Set the parent message — this is required:
Prerequisites: CometChat SDK initialized with CometChatUIKit.init(), a user logged in, and the UI Kit dependency added.

Actions and Events

Callback Methods

CometChatThreadHeader is a display-only header. It does not expose component-specific callbacks like setOnItemClick or setOnError. The one interactive element is the subscription bell — see Thread Subscription below.

SDK Events (Real-Time, Automatic)

The component listens to SDK events internally via its ViewModel. No manual setup needed.

Functionality


Thread Subscription

On Android the subscription bell belongs to CometChatThreadHeader — it renders as a trailing control on this component’s reply-count row. Thread subscription is enabled by default from v6.1.0; on v6.0.x the bell renders only after UIKitSettings.setEnableThreadSubscription(true). It flips optimistically on tap, reverts with a toast if the server rejects the change, and stays in step with the message list’s Subscribe / Unsubscribe action sheet option.
Visibility can also be set in XML via app:cometchatThreadSubscriptionVisibility.
To place the bell in the thread screen’s top title bar instead (as the CometChat sample apps do), Compose exposes it standalone — hide this component’s built-in bell and host ThreadSubscriptionBell in your own top bar:
This component’s own threadSubscriptionView replaces the bell in the reply-count row. It is the escape hatch for putting your own control there — it does not move the bell to the top bar. The same subscribe/unsubscribe action is also offered as a message option on CometChatMessageList, hidden independently with setThreadSubscriptionOptionVisibility(View.GONE) — an integrator may want one surface and not the other. See the Thread Subscription guide for the full feature.

Style

Define a custom style in themes.xml:
themes.xml
See Component Styling for the full reference.

ViewModel

See ViewModel & Data for state observation and custom repositories.

Next Steps

Message List

Display messages in a conversation

Message Header

Display user/group info in the toolbar

Message Composer

Rich input for sending messages

Conversations

Browse recent conversations