BiometricPrompt.Builder

public static class BiometricPrompt.Builder
extends Object

java.lang.Object
   ↳ android.hardware.biometrics.BiometricPrompt.Builder


A builder that collects arguments to be shown on the system-provided biometric dialog.

Summary

Public constructors

BiometricPrompt.Builder(Context context)

Creates a builder for a biometric dialog.

Public methods

BiometricPrompt build()

Creates a BiometricPrompt.

BiometricPrompt.Builder setDescription(CharSequence description)

Optional: Set the description to display.

BiometricPrompt.Builder setNegativeButton(CharSequence text, Executor executor, DialogInterface.OnClickListener listener)

Required: Set the text for the negative button.

BiometricPrompt.Builder setSubtitle(CharSequence subtitle)

Optional: Set the subtitle to display.

BiometricPrompt.Builder setTitle(CharSequence title)

Required: Set the title to display.

Inherited methods

Public constructors

BiometricPrompt.Builder

added in API level 28
public BiometricPrompt.Builder (Context context)

Creates a builder for a biometric dialog.

Public methods

build

added in API level 28
public BiometricPrompt build ()

Creates a BiometricPrompt.

Returns
BiometricPrompt a BiometricPrompt

Throws
IllegalArgumentException if any of the required fields are not set.

setDescription

added in API level 28
public BiometricPrompt.Builder setDescription (CharSequence description)

Optional: Set the description to display.

Returns
BiometricPrompt.Builder

setNegativeButton

added in API level 28
public BiometricPrompt.Builder setNegativeButton (CharSequence text, 
                Executor executor, 
                DialogInterface.OnClickListener listener)

Required: Set the text for the negative button. This would typically be used as a "Cancel" button, but may be also used to show an alternative method for authentication, such as screen that asks for a backup password.

Parameters
executor Executor

This value must never be null.

Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). To dispatch events through a shared thread pool, you can use AsyncTask.THREAD_POOL_EXECUTOR.

listener DialogInterface.OnClickListener

This value must never be null.

Returns
BiometricPrompt.Builder

setSubtitle

added in API level 28
public BiometricPrompt.Builder setSubtitle (CharSequence subtitle)

Optional: Set the subtitle to display.

Returns
BiometricPrompt.Builder

setTitle

added in API level 28
public BiometricPrompt.Builder setTitle (CharSequence title)

Required: Set the title to display.

Returns
BiometricPrompt.Builder