Skip to content

Enter Passcode Screen

The Layout of the EnterPasscodeScreen

In general, the enter passcode screen may contain:

  • An "Enter passcode" label
  • A passcode field
  • And a floating button for "Done".

The screen is enhanced with a label displaying the number of the remaining attempts. By default, this label is invisible and appears only if the user entered a wrong passcode. The counter of this attempts label is updated after entering a wrong passcode. If the maximum number of attempts reached (that is there is no more remaining attempt), then the passcode field is disabled and message dialog is displayed saying:

  • Maximum Passcode Attempts Reached (caption)
  • Please enter your credentials to Sign In and reset the passcode (text) and containing a single "OK" button.

Furthermore, the screen is extended to support resetting the passcode. In this case, the layout contains a reset button (labeled as Reset client) below the attempts label, allowing the user to reset the passcode. This is a disabled button be default and will be enabled only if the enter passcode screen is configured explicitly to enable it or an invalid passcode was provided by the user.

All the mentioned labels can be customized via the Settings configuration, that is you can overwrite them via the corresponding set methods of the EnterPasscodeSettings class. The EnterPasscodeSettings class can be instantiated with default constructor. The set methods should be called before calling the saveToIntent method, which saves the configuration into an Intent. Finally, this intent should be used when starting the EnterPasscodeActivity via the startActivityForResult method.

Customizing the Enter Passcode Screen

You can use the EnterPasscodeSettings object for customize the labels of the enter passcode screen. The following options are available:

public boolean isResetEnabled() {
        return resetEnabled;

public void setResetEnabled(boolean resetEnabled) {
    this.resetEnabled = resetEnabled;

public String getEnterYourPasscodeLabel() {
    return enterYourPasscodeLabel;

public void setEnterYourPasscodeLabel(String enterYourPasscodeLabel) {
    this.enterYourPasscodeLabel = enterYourPasscodeLabel;

public String getEnterYourCurrentPasscodeLabel() {
    return enterYourCurrentPasscodeLabel;

public void setEnterYourCurrentPasscodeLabel(String enterYourCurrentPasscodeLabel) {
    this.enterYourCurrentPasscodeLabel = enterYourCurrentPasscodeLabel;

public String getOneAttemptLeftMessage() {
    return oneAttemptLeftMessage;

public void setOneAttemptLeftMessage(String oneAttemptLeftMessage) {
    this.oneAttemptLeftMessage = oneAttemptLeftMessage;

public String getAttemptsLeftMessage() {
    return attemptsLeftMessage;

public void setAttemptsLeftMessage(String attemptsLeftMessage) {
    this.attemptsLeftMessage = attemptsLeftMessage;

public String getMaxAttemptsReachedMessage() {
    return maxAttemptsReachedMessage;

public void setMaxAttemptsReachedMessage(String maxAttemptsReachedMessage) {
    this.maxAttemptsReachedMessage = maxAttemptsReachedMessage;

public String getEnterCredentialsMessage() {
    return enterCredentialsMessage;

public void setEnterCredentialsMessage(String enterCredentialsMessage) {
    this.enterCredentialsMessage = enterCredentialsMessage;

public String getRetryPasscodeMessage() {
    return retryPasscodeMessage;

public void setRetryPasscodeMessage(String retryPasscodeMessage) {
    this.retryPasscodeMessage = retryPasscodeMessage;

public String getOkButtonString() {
    return okButtonString;

public void setOkButtonString(String okButtonString) {
    this.okButtonString = okButtonString;

Add Enter Passcode Screen Activity to Your Manifest File

The EnterPasscodeActivity should be added to the AndroidManifest.xml file in an activity xml tag. It is required to specify also the "action_handler" meta-data tag.


Start the EnterPasscodeActivity

The EnterPasscodeActivity can be started with standard startActivityResult method of the Activity and you can configure it via the EnterPasscodeSettings class. For example:

  Intent i = new Intent(this,
  EnterPasscodeSettings settings = new EnterPasscodeSettings();
   settings.setEnterYourPasscodeLabel("Enter passcode here");
   // config via set methods
   startActivityForResult(i, ENTER_PASSCODE);

Last update: April 14, 2021