EmojiCompat

public class EmojiCompat
extends Object

java.lang.Object
   ↳ androidx.emoji.text.EmojiCompat


Main class to keep Android devices up to date with the newest emojis by adding EmojiSpans to a given CharSequence. It is a singleton class that can be configured using a EmojiCompat.Config instance.

EmojiCompat has to be initialized using init(EmojiCompat.Config) function before it can process a CharSequence.

EmojiCompat.init(/* a config instance */);

It is suggested to make the initialization as early as possible in your app. Please check EmojiCompat.Config for more configuration parameters. Once init(EmojiCompat.Config) is called a singleton instance will be created. Any call after that will not create a new instance and will return immediately.

During initialization information about emojis is loaded on a background thread. Before the EmojiCompat instance is initialized, calls to functions such as process(CharSequence) will throw an exception. You can use the EmojiCompat.InitCallback class to be informed about the state of initialization.

After initialization the get() function can be used to get the configured instance and the process(CharSequence) function can be used to update a CharSequence with emoji EmojiSpans.

CharSequence processedSequence = EmojiCompat.get().process("some string")

Summary

Nested classes

class EmojiCompat.Config

Configuration class for EmojiCompat. 

interface EmojiCompat.GlyphChecker

Interface to check if a given emoji exists on the system. 

class EmojiCompat.InitCallback

Listener class for the initialization of the EmojiCompat. 

interface EmojiCompat.MetadataRepoLoader

Interface to load emoji metadata. 

class EmojiCompat.MetadataRepoLoaderCallback

Callback to inform EmojiCompat about the state of the metadata load. 

Constants

String EDITOR_INFO_METAVERSION_KEY

Key in EditorInfo.extras that represents the emoji metadata version used by the widget.

String EDITOR_INFO_REPLACE_ALL_KEY

Key in EditorInfo.extras that represents EmojiCompat.Config.setReplaceAll(boolean) configuration parameter.

int LOAD_STATE_DEFAULT

EmojiCompat instance is constructed, however the initialization did not start yet.

int LOAD_STATE_FAILED

An unrecoverable error occurred during initialization of EmojiCompat.

int