/ UIKit / Android
UIKit
Chat UIKit Android v3
Chat UIKit Android
Chat UIKit
Android
Version 3

Create a group channel

Copy link

Create new channels in Sendbird UIKit using the CreateChannelActivity. In the create group channel screen, the current user can select users from the user list to create a new group channel.


Create group channel screen

Copy link

A create group channel screen is composed of three components: header, user list, and user list status.

Header

Copy link

The header component shows the default title of the create group channel screen as New channel. It also has two buttons on the left and right corner of the header. When the left button is tapped, the finish() method of the activity is called to exit the current screen. When the right button is tapped, the group channel screen appears where the curren user is in a new channel with the selected users. The view of the header is created and customized in the SelectUserHeaderComponent of the CreateChannelModule.

User list

Copy link

The user list component shows a list of users' profile images, names, and selectable checkboxes. By default, all users registered to the Sendbird application are retrieved in reverse chronological order of creation. The view of the user list is created and customized in the CreateChannelUserListComponent of the CreateChannelModule. You can also customize each item in the list view using CreateChannelUserListAdapter.

User list status

Copy link

The user list status component shows the result of the data request for a message list. The StatusComponent exists in the CreateChannelModule and lets the user know if the list is loading or if the list could not be called.


UIKit for Android provides both activity and fragment to build a create group channel screen. You can choose which one to create your app with and you may solely use activity instead of fragment if you wish to. You can build a create group channel screen through CreateChannelActivity, which uses UIKitFragmentFactory to create views.

Start an activity

Copy link

You can start an activity by using intent to move from one activity to CreateChannelActivity as shown below:

KotlinJava
val intent = CreateChannelActivity.newIntent(context)
startActivity(intent)

Create a fragment

Copy link

CreateChannelActivity allows you to create a basic CreateChannelFragment through UIKitFragmentFactory and CreateChannelFragment.Builder. UIKitFragmentFactory has a set of methods that build each fragment, whereas the builder class provides APIs to customize the UI of the data and event handlers used in CreateChannelFragment. To see all APIs of CreateChannelFragment.Builder, refer to the API reference page.

KotlinJava
val fragment = CreateChannelFragment.Builder().build()

Note: To use UIKit's fragments as a nested fragment, refer to the Android Developer Documentation's Nested Fragments.


Customization

Copy link

In the create channel key function, you can customize CreateChannelFragment to change different aspects of the screen. The CreateChannelFragment.Builder class allows you to create and customize the basic CreateChannelFragment that UIKit provides but you can only change its own APIs, such as setting a layout. If you wish to customize the fragment beyond using the APIs provided in the builder, you must inherit new customization methods.

The following table shows the main classes used in CreateChannelFragment to display and customize the create group channel screen.

FragmentModuleComponentStyleRecyclerView

CreateChannelFragment

CreateChannelModule

SelectUserHeaderComponent

CreateChannelUserListComponent

StatusComponent

Module.CreateChannel

CreateChannelUserListAdapter

Depending on the UI or the feature you wish to customize in the fragment, you can change the classes mentioned in the table. To learn how to customize the fragment, see the Customization overview page for further details.

Note: The links to the above customization pages provide an example of how to customize classes related to ChannelFragment. In order to make changes to the create group channel screen, you must use the correct classes.