Skip to main content
The Conversation List + Message View layout offers a seamless two-panel chat interface, commonly used in modern messaging applications like WhatsApp Web, Slack, and Microsoft Teams. This design enables users to switch between conversations effortlessly while keeping the chat window open, ensuring a smooth, real-time messaging experience.

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 Conversation Activity

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

Layout

Define the layout using the CometChatConversations component:
activity_conversations.xml

Activity

Initialize and handle conversation clicks:
ConversationActivity.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: Set Up Message Activity

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

Layout

activity_message.xml

Activity

Use the user/group passed from the conversation click:
MessageActivity.kt

Step 3: 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