Live Android v1
Live Android
Live
Android
Home
/
Live
/
Android
/
UIKit

List live events

You can use the LiveEventListFragment class as the starting point of using the UIKit. You can use this class to build a live event list view where a user can list, create, and enter a live event. When there's no connection between the client app and the Sendbird server, the UIKit will automatically reconnect the two using user information obtained during the UIKit authentication. Once the client app is connected to the Sendbird server, the LiveEventListFragment will show a list of live events.


Component

A live event list screen is composed of three components: header, live event list, and live event list status.

Header

The header component shows the title of the live event list screen and shows a button on the top right corner. You will be able to create the live event in the corresponding key function.

Live event list

The live event list component shows a list of all live events. The live event list creates a ReyclerView. To create the view of each live event list item, you need to use LiveEventListAdapter and bind live event data to the view. When the current user taps on one of the live events in the list, they'll be able to enter the live event in Live event.

List of live event states

Each label indicates the state of a live event displayed in the list.

StateHostParticipant

Created

Host has created the live event. They can enter and exit without ending live event. In this state, the host can also start and stop streaming, and configure media settings.

Participants can't enter the live event.

Ready

Host is ready for participants to join. They can enter and exit without ending the live event. In this status, the host can also start and stop streaming, and view their own media stream.

Participants can enter the live event and use the chat, but can't receive the host's media stream yet.

Ongoing

Host can turn on or off media stream, update the live event information, and exit without ending the live event.

Participants can receive the host's media stream, and use the chat.

Ended

Host can end live event.

Participants are notified that the live event has ended.


Usage

Sendbird Live UIKit for Android provides both activity and fragment to create a live event list screen. You can choose which one to build your client app with and you may solely use activity instead of fragment if you wish to. You can build a live event list screen through LiveEventListActivity, which uses LiveUIKitFragmentFactory to create views.

Start an activity

You can start an activity by using intent to move from one activity to LiveEventListActivity as shown below.

val intent = LiveEventListActivity.newIntent(context);
startActivity(intent);

Create a fragment

LiveEventListActivity allows you to create a basic LiveEventListFragment through LiveUIKitFragmentFactory and LiveEventListFragment.Builder. LiveUIKitFragmentFactory 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 LiveEventListFragment.

val fragment = LiveEventListFragment.Builder().build();

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


Customization

In the list live event key function, you can customize LiveEventListFragment to change different aspects of the screen. The LiveEventListFragment.Builder class allows you to create and customize the basic LiveEventListFragment that the Live 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 LiveEventListFragment to display and customize the live event list screen.

FragmentStyleRecyclerView

LiveEventListFragment

Widget.SendbirdLive.LiveEventItemView

ChannelListAdapter

String resource

The following table lists some of the text strings that you can customize to modify the live event list view. To see a full list, see String resource.

<resources>
    <string name="sb_live_list_empty_description">No live events</string>
    <string name="sb_live_live_event_create_header_right_button">Create</string>
    <string name="sb_live_live_event_enter_role_dialog_title">Choose your role</string>
    <string name="sb_live_live_event_enter_role_dialog_option_host">Host</string>
    <string name="sb_live_live_event_enter_role_dialog_option_participant">Participant</string>
    <string name="sb_live_list_host_nickname_default_placeholder">Host</string>
    <string name="sb_live_list_host_nickname_empty_placeholder">—</string>
</resources>