UIKit Android v3
UIKit Android
UIKit
Android
Home
/
UIKit
/
Android
This is the new Docs for UIKit v3 for Android. To see the previous Docs, click here.

Typing indicator

Typing indicator is a feature that allows users to know visually if another user in the channel is typing a message. The indicator UI appears in the ChannelHeaderComponent of the ChannelModule and in the ChannelListComponent of the ChannelListModule. The indicator remains visible until the user sends the message or deletes the text completely. If the user stops typing for more than 10 seconds, the indicator will also disappear.

In order to use the typing indicator feature, you must first create a channel and enable the chat service. Once chat is enabled, the typing indicator feature is turned on by default through the setUseTypingIndicator() setter method of the ChannelFragment.Builder class or ChannelHeaderComponent.Params class. To learn how to allow users to chat in a channel, refer to the Chat in a group channel page.


How to use

While the typing indicator feature is turned on by default in ChannelModule, you need to set the feature's setter method to true in ChannelListModule. Implement the code below to turn on the typing indicator in a channel list view.

public class BaseApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        SendbirdUIKit.setUseChannelListTypingIndicators(true);
    }
}

Customize the UI for typing indicator

The UI for typing indicator can be customized through the string resource. The string resource is a set of strings used to compose the screen. It’s a res/strings.xml file containing UIKit-defined string values.

Text strings for typing status can vary depending on the number of members typing in a channel:

  • If one member is typing: “Member is typing...”
  • If two members are simultaneously typing: “Member A and Member B are typing...”
  • If more than two members are simultaneously typing: “Several people are typing...”

String resource

<resources>
    <string name="sb_text_channel_typing_indicator_single">%s is typing&#8230;</string>
    <string name="sb_text_channel_typing_indicator_double">%s and %s are typing&#8230;</string>
    <string name="sb_text_channel_typing_indicator_multiple">Several people are typing&#8230;</string>
</resources>