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

Create a live event

You can use the CreateLiveEventActivity class to build a view for creating a new live event. When creating a live event, you can set a cover image and a title for the event. Also, you can add up to ten users who can be a host.

If you set the starting point of your service to the live event list, you can seamlessly guide your users to the create live event view. Once a new live event is successfully created, the user will be brought back to the live event list view. By default, the user who created the live event becomes the host of the event.

List of features

See the table below to see what features are available in CreateLiveEventActivity.

FeatureDescription

Create a live event

Creates a new live event.

Configure live event

Allows a user to enter a title and add a cover image for the live event.

Select users to be host

Allows a user to select other users who can act as hosts.


Component

Header

The header component shows the default title of the create live event screen as New live event. 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 live event is created and the live event list shows up on the screen.

Live event configure

The live event configure component allows a user to enter a title and add a cover image for the live event. Once the cover image view is tapped, the bottom dialog will appear and a user will be able to add his image from photo library or to take directly from camera. You can set the title of the live event in the "Edit text" view. Also, when you click the layout below "Edit text", SelectHostUserActivity appears in order to select the host of the live event.


Usage

Sendbird Live UIKit for Android provides both activity and fragment to create a live event create 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 live event create screen through CreateLiveEventActivity, which uses LiveUIKitFragmentFactory to create views.

Start an activity

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

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

Create a fragment

CreateLiveEventActivity allows you to create a basic CreateLiveEventFragment through LiveUIKitFragmentFactory and CreateLiveEventFragment.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 CreateLiveEventFragment.

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

Customization

In this key function, you can customize CreateLiveEventFragment to change different aspects of the screen. The CreateLiveEventFragment.Builder class allows you to create and customize the basic CreateLiveEventFragment 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.

String resource

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

<resources>
    <string name="sb_live_button_photo_library">Photo Library</string>
    <string name="sb_live_button_remove_photo">Remove photo</string>
    <string name="sb_live_button_take_photo">Take photo</string>
    <string name="sb_live_live_event_create_header_right_button">Create</string>
    <string name="sb_live_live_event_create_header_title">New live event</string>
    <string name="sb_live_live_event_create_event_title">Title</string>
    <string name="sb_live_live_event_create_event_title_placeholder">Add a title</string>
    <string name="sb_live_live_event_create_event_users_for_host">Users who can be host</string>
</resources>