A channel list shows a complete list of group channels that the current user is a member of. Once a connection with Sendbird server is established, you can display and manage the channel list without complex implementation. All chat services built with Sendbird UIKit begin from the channel list.
Channel list screen
A channel list screen is composed of three components: header, channel list, and channel list status.
The header component shows the title of the channel list screen and shows a button on the top right corner, by default, that allows you to choose the type of channel you wish to create. After the channel type is selected, you will be able to create the channel in the corresponding key function. The view of the channel list header is created and customized in the
HeaderComponent of the
The channel list component shows a list of all channels that the current user is part of. The channel list creates a ReyclerView in the
ChannelListComponent as all UIs in the form of a list in UIKit for Sendbird are implemented as a RecyclerView. To create the view of each channel list item, you need to use
ChannelListAdapter and bind channel data to the view. When the current user taps on one of the channels in the list, they'll be able to enter the channel in Chat in a group channel screen depending on the channel type.
Channel list status
The channel list status component shows the result of the data request for a channel list. The
StatusComponent exists in the
ChannelListModule 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 create a channel list screen. You can choose which one to build your app with and you may solely use activity instead of fragment if you wish to. You can build a channel list screen through
ChannelListActivity, which uses
UIKitFragmentFactory to create views.
Start an activity
You can start an activity by using
intent to move from one activity to
ChannelListActivity as shown below:
Create a fragment
ChannelListActivity allows you to create a basic
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
ChannelListFragment. To see all APIs of
ChannelListFragment.Builder, refer to the API reference page.
Note: To use UIKit's fragments as a nested fragment, refer to the Android Developer Documentation's Nested Fragments.
Implement push notifications
You can also implement push notifications so users can access
ChannelListActivity from other activities in the client app. Users should be able to access
ChannelListActivity from a channel that they entered upon tapping on a push notification. The unique URL of the channel must be passed as an argument to a parameter when creating
In the list channel key function, you can customize
ChannelListFragment to change different aspects of the screen. The
ChannelListFragment.Builder class allows you to create and customize the basic
ChannelListFragment 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
ChannelListFragment to display and customize the channel list screen.
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, follow the links to the customization page listed below:
- Customize the layout of the view
- Customize style of the view
- Bind event handlers to the view
- Add new APIs to the fragment
- Update or change an item in a list
Note: The links to the Customization page provide an example of how to customize classes related to
ChannelFragment. In order to make changes to the channel list, you must use the correct classes.