Skip to main content
The One-to-One Chat feature provides a streamlined direct messaging interface, making it ideal for support chats, dating apps, and private messaging platforms. This setup eliminates distractions by focusing solely on a dedicated chat window.

User Interface Preview

Key Components

  1. Chat Header – Displays user/group name, profile image, and status.
  2. Message List – Shows chat history and new messages.
  3. Message Composer – Allows users to send messages, media, and reactions.

Step-by-Step Guide

Step 1: Set Up Message Activity

Create an Activity - MessageActivity.kt to manage and display the chat UI.

Layout

Define the layout using CometChat UI Kit components:
activity_message.xml

Activity

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: Update MainActivity

Update the MainActivity to navigate to the MessageActivity:
MainActivity.kt

Running the Project

Once the components are configured, build and run the app:
Ensure you’ve added the necessary permissions and initialized CometChat in your Application class.

Next Steps

Enhance the User Experience