PasswordCallback  |  API reference  |  Android Developers (original) (raw)

open class PasswordCallback : Callback, Serializable

Underlying security services instantiate and pass a PasswordCallback to the handle method of a CallbackHandler to retrieve password information.

Summary

Public constructors
PasswordCallback(prompt: String!, echoOn: Boolean) Construct a PasswordCallback with a prompt and a boolean specifying whether the password should be displayed as it is being typed.
Public methods
open Unit clearPassword() Clear the retrieved password.
open CharArray! getPassword() Get the retrieved password.
open String! getPrompt() Get the prompt.
open Boolean isEchoOn() Return whether the password should be displayed as it is being typed.
open Unit setPassword(password: CharArray!) Set the retrieved password.

Public constructors

PasswordCallback

PasswordCallback(
    prompt: String!,
    echoOn: Boolean)

Construct a PasswordCallback with a prompt and a boolean specifying whether the password should be displayed as it is being typed.

Parameters
prompt String!: the prompt used to request the password.
echoOn Boolean: true if the password should be displayed as it is being typed.
Exceptions
java.lang.IllegalArgumentException if prompt is null or if prompt has a length of 0.

Public methods

clearPassword

open fun clearPassword(): Unit

Clear the retrieved password.

getPassword

open fun getPassword(): CharArray!

Get the retrieved password.

This method returns a copy of the retrieved password.

Return
CharArray! the retrieved password, which may be null.

getPrompt

open fun getPrompt(): String!

Get the prompt.

Return
String! the prompt.

isEchoOn

open fun isEchoOn(): Boolean

Return whether the password should be displayed as it is being typed.

Return
Boolean the whether the password should be displayed as it is being typed.

setPassword

open fun setPassword(password: CharArray!): Unit

Set the retrieved password.

This method makes a copy of the input password before storing it.

Parameters
password CharArray!: the retrieved password, which may be null.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025-02-10 UTC.