Skip to main content
This guide builds a single chat window — no sidebar, no conversation list. Users go directly into a one-to-one or group chat. Good for support chat, dating apps, or notification-driven flows. This assumes you’ve already completed Integration (project created, dependencies installed, init + login working, theme set up).

What You’re Building

Three components stacked vertically:
  1. Message header — displays user/group name, avatar, and status
  2. Message list — real-time chat history with scrolling
  3. Message composer — text input with media and attachments
The user or group ID is passed via Intent extras when launching the Activity — ideal for launching from a user profile, support button, or notification.

Step 1: Set Up Message Activity

Create an Activity - MessageActivity to display the full-screen chat interface.

Layout

Define the layout with CometChatMessageHeader, CometChatMessageList, and CometChatMessageComposer in activity_message.xml:
activity_message.xml

Activity

Retrieve the user or group ID from the Intent extras and configure the message components:
MessageActivity.kt
You must use an activity that supports the lifecycle API, such as:
  • AppCompatActivity
  • ComponentActivity
  • FragmentActivity
This is necessary to properly manage the UI Kit’s lifecycle events.

Step 2: Launch MessageActivity from Your App

Update your MainActivity (or any other Activity) to launch MessageActivity with the appropriate user or group ID:
Passing Data via IntentYou can pass either:
  • uid (String) - for one-to-one chats
  • guid (String) - for group chats
The MessageActivity will automatically detect which type of chat to display based on the Intent extras.
MainActivity.kt

Running the Project

Once you’ve completed the setup, build and run the app:
Required PermissionsEnsure you’ve added the necessary permissions in your AndroidManifest.xml and initialized CometChat in your Application class. :

Next Steps

Components Overview

Explore all available UI Kit components and their customization options

Theming

Customize colors, fonts, and styles to match your brand

Integration

Back to the main setup guide

Feature Guides

Add capabilities like threaded messages, blocking, and group management