Skip to content

Most visited

Recently visited

navigation

FontsContract.FontRequestCallback

public static class FontsContract.FontRequestCallback
extends Object

java.lang.Object
   ↳ android.provider.FontsContract.FontRequestCallback


Interface used to receive asynchronously fetched typefaces.

Summary

Constants

int FAIL_REASON_FONT_LOAD_ERROR

Constant returned by onTypefaceRequestFailed(int) signaling that the font returned by the provider was not loaded properly.

int FAIL_REASON_FONT_NOT_FOUND

Constant returned by onTypefaceRequestFailed(int) signaling that the font provider did not return any results for the given query.

int FAIL_REASON_FONT_UNAVAILABLE

Constant returned by onTypefaceRequestFailed(int) signaling that the font provider found the queried font, but it is currently unavailable.

int FAIL_REASON_MALFORMED_QUERY

Constant returned by onTypefaceRequestFailed(int) signaling that the given query was not supported by the provider.

int FAIL_REASON_PROVIDER_NOT_FOUND

Constant returned by onTypefaceRequestFailed(int) signaling that the given provider was not found on the device.

int FAIL_REASON_WRONG_CERTIFICATES

Constant returned by onTypefaceRequestFailed(int) signaling that the given provider must be authenticated and the given certificates do not match its signature.

Public constructors

FontsContract.FontRequestCallback()

Public methods

void onTypefaceRequestFailed(int reason)

Called when a Typeface request done via ERROR(/#requestFont)} fails.

void onTypefaceRetrieved(Typeface typeface)

Called then a Typeface request done via ERROR(/#requestFont) is complete.

Inherited methods

From class java.lang.Object

Constants

FAIL_REASON_FONT_LOAD_ERROR

added in API level 26
int FAIL_REASON_FONT_LOAD_ERROR

Constant returned by onTypefaceRequestFailed(int) signaling that the font returned by the provider was not loaded properly.

Constant Value: -3 (0xfffffffd)

FAIL_REASON_FONT_NOT_FOUND

added in API level 26
int FAIL_REASON_FONT_NOT_FOUND

Constant returned by onTypefaceRequestFailed(int) signaling that the font provider did not return any results for the given query.

Constant Value: 1 (0x00000001)

FAIL_REASON_FONT_UNAVAILABLE

added in API level 26
int FAIL_REASON_FONT_UNAVAILABLE

Constant returned by onTypefaceRequestFailed(int) signaling that the font provider found the queried font, but it is currently unavailable.

Constant Value: 2 (0x00000002)

FAIL_REASON_MALFORMED_QUERY

added in API level 26
int FAIL_REASON_MALFORMED_QUERY

Constant returned by onTypefaceRequestFailed(int) signaling that the given query was not supported by the provider.

Constant Value: 3 (0x00000003)

FAIL_REASON_PROVIDER_NOT_FOUND

added in API level 26
int FAIL_REASON_PROVIDER_NOT_FOUND

Constant returned by onTypefaceRequestFailed(int) signaling that the given provider was not found on the device.

Constant Value: -1 (0xffffffff)

FAIL_REASON_WRONG_CERTIFICATES

added in API level 26
int FAIL_REASON_WRONG_CERTIFICATES

Constant returned by onTypefaceRequestFailed(int) signaling that the given provider must be authenticated and the given certificates do not match its signature.

Constant Value: -2 (0xfffffffe)

Public constructors

FontsContract.FontRequestCallback

added in API level 26
FontsContract.FontRequestCallback ()

Public methods

onTypefaceRequestFailed

added in API level 26
void onTypefaceRequestFailed (int reason)

Called when a Typeface request done via ERROR(/#requestFont)} fails.

Parameters
reason int: One of FAIL_REASON_PROVIDER_NOT_FOUND, FAIL_REASON_FONT_NOT_FOUND, FAIL_REASON_FONT_LOAD_ERROR, FAIL_REASON_FONT_UNAVAILABLE or FAIL_REASON_MALFORMED_QUERY if returned by the system. May also be a positive value greater than 0 defined by the font provider as an additional error code. Refer to the provider's documentation for more information on possible returned error codes.

onTypefaceRetrieved

added in API level 26
void onTypefaceRetrieved (Typeface typeface)

Called then a Typeface request done via ERROR(/#requestFont) is complete. Note that this method will not be called if onTypefaceRequestFailed(int) is called instead.

Parameters
typeface Typeface: The Typeface object retrieved.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)