My groups page
The My Groups page displays the groups that the current user has joined. When the page opens, the SDK retrieves group information from the local database. Chat UI provides the group list page through GroupListActivity and GroupListFragment.
Group list page
The group list page displays the user's joined groups and supports searching groups, opening group chats, and long-pressing groups for additional actions. The following components make up the group list page:
- GroupListActivity: The container class for the group list page that loads and displays
GroupListFragment. - GroupListFragment: The core component that displays the list of joined groups and handles user interactions.
- GroupListViewModel: The data and business logic handler that retrieves group data from the server or local storage and passes it to
GroupListFragment. - XML layout:
nc_page_group_list.xml

Start the group list page
Java
int pageCount = 50; // Page size for pagination, default is 50
startActivity(GroupListActivity.newIntent(this, pageCount));
Customize the group list page
Java
// Custom GroupListFragment
public class CustomGroupListFragment extends GroupListFragment {
@Override
protected void onViewReady(@NonNull GroupListViewModel viewModel) {
super.onViewReady(viewModel);
// Override search click event
searchComponent.setSearchClickListener(
v -> startActivity(GroupSearchActivity.newIntent(getContext())));
}
/**
* Handle group item click
*
* @param groupInfo Group information
*/
protected void onGroupItemClick(GroupInfo groupInfo) {
}
/**
* Handle group item long click
*
* @param groupInfo Group information
*/
protected void onGroupItemLongClick(GroupInfo groupInfo) {}
}
Group search page
The group search page allows users to search and quickly locate groups they have joined. The following components make up the group search page:
- GroupSearchActivity: The container class for the group search page that loads and displays
GroupSearchFragment. - GroupSearchFragment: The core component that displays search results and handles user interactions.
- GroupSearchViewModel: The data and business logic handler that searches joined groups from the server or local storage and passes results to
GroupSearchFragment. - XML layout:
nc_page_group_search.xml

Start the group search page
Java
int pageCount = 50; // Page size for pagination, default is 50
startActivity(GroupSearchActivity.newIntent(this, pageCount));
Customize the group search page
Java
// Custom GroupSearchFragment
public class CustomGroupSearchFragment extends GroupSearchFragment {
/**
* Handle group item click
*
* @param groupInfo Group information
*/
protected void onGroupItemClick(GroupInfo groupInfo) {
}
/**
* Handle group item long click
*
* @param groupInfo Group information
*/
protected void onGroupItemLongClick(GroupInfo groupInfo) {}
}