Group Conversations by Type
The IMKit SDK supports grouping (collapsing) conversations by type in the conversation list. When grouping is enabled, conversations of the specified type are displayed as a single aggregated entry in the list. By default, the conversation list displays all local conversations in a flat structure.
The diagram below illustrates the effect of grouping one-to-one chat conversations. In the conversation list, all one-to-one chats are collapsed into a One-to-One Chats entry (left). Tapping it navigates to the grouped conversation list (right).
The IMKit SDK includes a title bar implementation in the default grouped conversation page Activity (RongSubConversationListActivity). If you're building a grouped conversation list page based on Fragment, implement the title bar yourself.

Limitations
- Pinning is not supported for grouped conversation entries in the conversation list.
- Grouping is only supported by conversation type, not by conversation ID.
Configure Grouped Conversation Types
The grouped conversation feature supports one-to-one chats, group chats, and system conversations. You can implement a custom data processor by extending BaseDataProcessor and providing it to IMKit before opening the conversation list.
-
Declare a custom data processor class
MyAggregateDataProcessorthat extends the SDK'sBaseDataProcessor. Override theisGatheredmethod to returntruefor conversation types that should be grouped. The example below groups all system conversations.public class MyAggregateDataProcessor extends BaseDataProcessor<Conversation> {
/**
* Define supported conversation types for the custom conversation list page. Here we enable one-to-one, group, and system conversations.
*/
@Override
public Conversation.ConversationType[] supportedTypes() {
Conversation.ConversationType[] types = {Conversation.ConversationType.PRIVATE, Conversation.ConversationType.GROUP, Conversation.ConversationType.SYSTEM};
return types;
}
/**
* Define which conversations to group. Here we group one-to-one chats.
*/
@Override
public boolean isGathered(Conversation.ConversationType type) {
if (type.equals(Conversation.ConversationType.PRIVATE)) {
return true;
} else {
return false;
}
}
} -
Before opening the conversation list, set the data processor using
setDataProcessor.RongConfigCenter.conversationListConfig().setDataProcessor(new MyAggregateDataProcessor());
Grouped Conversation List Page
When grouping is enabled, conversations of the specified type are collapsed into a grouped conversation entry (GatheredConversation) in the list. Tapping this entry navigates to the grouped conversation list page.
IMKit provides grouped conversation list pages implemented as both an Activity and a Fragment.
- Activity-based: IMKit includes a default grouped conversation list page
RongSubConversationListActivity, which displays a title bar and a grouped conversation list. The SDK navigates to this Activity by default when opening a grouped conversation list. - Fragment-based: You can use IMKit's
SubConversationListFragmentto build a custom grouped conversation list page. Note that you must register your custom conversation list Activity with the IMKit SDK to replace the default grouped conversation list Activity.