# FontRequestEmojiCompatConfig

Artifact: [androidx.emoji:emoji](https://developer.android.com/jetpack/androidx/releases/emoji) [View Source](https://cs.android.com/search?q=file:androidx/emoji/text/FontRequestEmojiCompatConfig.java+class:androidx.emoji.text.FontRequestEmojiCompatConfig) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji#1.0.0)

*** ** * ** ***


```
public class FontRequestEmojiCompatConfig extends EmojiCompat.Config
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.emoji.text.EmojiCompat.Config](https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config) ||
|   | ↳ | [androidx.emoji.text.FontRequestEmojiCompatConfig](https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig) |

*** ** * ** ***

`https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config` implementation that asynchronously fetches the required font and the metadata using a `https://developer.android.com/reference/androidx/core/provider/FontRequest`. FontRequest should be constructed to fetch an EmojiCompat compatible emoji font.

## Summary

| ### Nested types |
|---|
| `public class https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig.ExponentialBackoffRetryPolicy extends https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig.RetryPolicy` A retry policy implementation that doubles the amount of time in between retries. |
| `public abstract class https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig.RetryPolicy` Retry policy used when the font provider is not ready to give the font file. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig#FontRequestEmojiCompatConfig(android.content.Context,androidx.core.provider.FontRequest)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/provider/FontRequest request )` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig` | `https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig#setHandler(android.os.Handler)(https://developer.android.com/reference/android/os/Handler.html handler)` Sets the custom handler to be used for initialization. |
| `https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig` | `https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig#setRetryPolicy(androidx.emoji.text.FontRequestEmojiCompatConfig.RetryPolicy)(https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig.RetryPolicy policy)` Sets the retry policy. |

| ### Inherited methods |
|---|
| From [androidx.emoji.text.EmojiCompat.Config](https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config) |---|---| | `final https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.MetadataRepoLoader` | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config#getMetadataRepoLoader()()` Returns the `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.MetadataRepoLoader`. | | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config` | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config#registerInitCallback(androidx.emoji.text.EmojiCompat.InitCallback)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.InitCallback initCallback)` Registers an initialization callback. | | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config` | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config#setEmojiSpanIndicatorColor(int)(@https://developer.android.com/reference/androidx/annotation/ColorInt int color)` Sets the color used as emoji span indicator. | | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config` | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config#setEmojiSpanIndicatorEnabled(boolean)(boolean emojiSpanIndicatorEnabled)` Determines whether a background will be drawn for the emojis that are found and replaced by EmojiCompat. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config` | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config#setGlyphChecker(androidx.emoji.text.EmojiCompat.GlyphChecker)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.GlyphChecker glyphChecker)` The interface that is used by EmojiCompat in order to check if a given emoji can be rendered by the system. | | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config` | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config#setMetadataLoadStrategy(int)(int strategy)` Determines the strategy to start loading the metadata. | | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config` | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config#setReplaceAll(boolean)(boolean replaceAll)` Determines whether EmojiCompat should replace all the emojis it finds with the EmojiSpans. | | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config` | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config#setUseEmojiAsDefaultStyle(boolean)(boolean useEmojiAsDefaultStyle)` Determines whether EmojiCompat should use the emoji presentation style for emojis that have text style as default. | | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config` | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config#setUseEmojiAsDefaultStyle(boolean,java.util.List<java.lang.Integer>)( boolean useEmojiAsDefaultStyle, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/Integer.html> emojiAsDefaultStyleExceptions )` | | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config` | `https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.Config#unregisterInitCallback(androidx.emoji.text.EmojiCompat.InitCallback)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/emoji/text/EmojiCompat.InitCallback initCallback)` Unregisters a callback that was added before. | |

## Public constructors

### FontRequestEmojiCompatConfig

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji#1.0.0)

```
public FontRequestEmojiCompatConfig(
    @NonNull Context context,
    @NonNull FontRequest request
)
```

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | Context instance, cannot be `null` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/provider/FontRequest request` | `https://developer.android.com/reference/androidx/core/provider/FontRequest` to fetch the font asynchronously, cannot be `null` |

## Public methods

### setHandler

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji#1.0.0)

```
public FontRequestEmojiCompatConfig setHandler(Handler handler)
```

Sets the custom handler to be used for initialization. Since font fetch take longer time, the metadata loader will fetch the fonts on the background thread. You can pass your own handler for this background fetching. This handler is also used for retrying.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/os/Handler.html handler` | A `https://developer.android.com/reference/android/os/Handler.html` to be used for initialization. Can be `null`. In case of `null`, the metadata loader creates own `https://developer.android.com/reference/android/os/HandlerThread.html` for initialization. |

### setRetryPolicy

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji#1.0.0)

```
public FontRequestEmojiCompatConfig setRetryPolicy(FontRequestEmojiCompatConfig.RetryPolicy policy)
```

Sets the retry policy. {@see RetryPolicy}

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig.RetryPolicy policy` | The policy to be used when the font provider is not ready to give the font file. Can be `null`. In case of `null`, the metadata loader never retries. |