# ResourcesCompat.FontCallback

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/content/res/ResourcesCompat.java+class:androidx.core.content.res.ResourcesCompat.FontCallback) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***


```
public abstract class ResourcesCompat.FontCallback
```

<br />

*** ** * ** ***

Interface used to receive asynchronous font fetching events.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/core/content/res/ResourcesCompat.FontCallback#FontCallback()()` |

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/core/content/res/ResourcesCompat.FontCallback#onFontRetrievalFailed(int)(int reason)` Called when an asynchronous font failed to load. |
| `abstract void` | `https://developer.android.com/reference/androidx/core/content/res/ResourcesCompat.FontCallback#onFontRetrieved(android.graphics.Typeface)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Typeface.html typeface)` Called when an asynchronous font was finished loading. |

## Public constructors

### FontCallback

Added in 1.1.0

```
public FontCallback()
```

## Public methods

### onFontRetrievalFailed

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

```
public abstract void onFontRetrievalFailed(int reason)
```

Called when an asynchronous font failed to load.

| Parameters |
|---|---|
| `int reason` | The reason the font failed to load. One of `https://developer.android.com/reference/androidx/core/provider/FontsContractCompat.FontRequestCallback#FAIL_REASON_PROVIDER_NOT_FOUND()`, `https://developer.android.com/reference/androidx/core/provider/FontsContractCompat.FontRequestCallback#FAIL_REASON_WRONG_CERTIFICATES()`, `https://developer.android.com/reference/androidx/core/provider/FontsContractCompat.FontRequestCallback#FAIL_REASON_FONT_LOAD_ERROR()`, `https://developer.android.com/reference/androidx/core/provider/FontsContractCompat.FontRequestCallback#FAIL_REASON_SECURITY_VIOLATION()`, `https://developer.android.com/reference/androidx/core/provider/FontsContractCompat.FontRequestCallback#FAIL_REASON_FONT_NOT_FOUND()`, `https://developer.android.com/reference/androidx/core/provider/FontsContractCompat.FontRequestCallback#FAIL_REASON_FONT_UNAVAILABLE()` or `https://developer.android.com/reference/androidx/core/provider/FontsContractCompat.FontRequestCallback#FAIL_REASON_MALFORMED_QUERY()`. |

### onFontRetrieved

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

```
public abstract void onFontRetrieved(@NonNull Typeface typeface)
```

Called when an asynchronous font was finished loading.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Typeface.html typeface` | The font that was loaded. |