public class FontRequestEmojiCompatConfig
extends EmojiCompat.Config

   ↳ androidx.emoji2.text.EmojiCompat.Config
     ↳ androidx.emoji2.text.FontRequestEmojiCompatConfig

EmojiCompat.Config implementation that asynchronously fetches the required font and the metadata using a FontRequest. FontRequest should be constructed to fetch an EmojiCompat compatible emoji font.


Nested classes

class FontRequestEmojiCompatConfig.ExponentialBackoffRetryPolicy

A retry policy implementation that doubles the amount of time in between retries. 

class FontRequestEmojiCompatConfig.RetryPolicy

Retry policy used when the font provider is not ready to give the font file. 

Public constructors

FontRequestEmojiCompatConfig(Context context, FontRequest request)

Public methods

FontRequestEmojiCompatConfig setHandler(Handler handler)

This method is deprecated. please call setLoadingExecutor instead

FontRequestEmojiCompatConfig setLoadingExecutor(Executor executor)

Sets the custom executor to be used for initialization.

FontRequestEmojiCompatConfig setRetryPolicy(FontRequestEmojiCompatConfig.RetryPolicy policy)

Sets the retry policy.

Inherited methods

Public constructors


public FontRequestEmojiCompatConfig (Context context, 
                FontRequest request)

context Context: Context instance, cannot be null

request FontRequest: FontRequest to fetch the font asynchronously, cannot be null

Public methods


public FontRequestEmojiCompatConfig setHandler (Handler handler)

This method is deprecated.
please call setLoadingExecutor instead

Please us setLoadingExecutor(Executor) instead to set background loading thread. This was deprecated in emoji2 1.0.0-alpha04. If migrating from androidx.emoji please prefer to use an existing background executor for setLoadingExecutor. Note: This method will no longer have any effect if passed null, which is a breaking change from androidx.emoji.

handler Handler: background thread handler to wrap in an Executor, if null this method will do nothing



public FontRequestEmojiCompatConfig setLoadingExecutor (Executor executor)

Sets the custom executor to be used for initialization. Since font loading is too slow for the main thread, the metadata loader will fetch the fonts on a background thread. By default, FontRequestEmojiCompatConfig will create its own single threaded Executor, which causes a thread to be created. You can pass your own executor to control which thread the font is loaded on, and avoid an extra thread creation.

executor Executor: background executor for performing font load



public FontRequestEmojiCompatConfig setRetryPolicy (FontRequestEmojiCompatConfig.RetryPolicy policy)

Sets the retry policy.