Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/text/ShowSecretsSetting#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/text/ShowSecretsSetting#inhmethods)

# ShowSecretsSetting

*** ** * ** ***


`
public

final

class
ShowSecretsSetting
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.text.ShowSecretsSetting |

<br />

*** ** * ** ***

This is the API surface for interacting with the settings that determine whether characters in
password inputs or other secret fields are echoed briefly or hidden immediately.

## Summary

| ### Public methods ||
|---|---|
| ` static https://developer.android.com/reference/java/lang/Runnable` | ` https://developer.android.com/reference/android/text/ShowSecretsSetting#registerCallback(android.content.Context,%20java.lang.Runnable)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/lang/Runnable callback) ` Registers a callback to be notified when show password settings change. |
| ` static https://developer.android.com/reference/java/lang/Runnable` | ` https://developer.android.com/reference/android/text/ShowSecretsSetting#registerCallback(android.content.Context,%20java.util.concurrent.Executor,%20java.lang.Runnable)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/java/lang/Runnable callback) ` Registers a callback to be notified when show password settings change. |
| ` static boolean` | ` https://developer.android.com/reference/android/text/ShowSecretsSetting#shouldShowPhysicalInput(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` Returns `true` when characters entered into a password, pin or other secret field from hardware/physical input sources should either be shown or echoed briefly. |
| ` static boolean` | ` https://developer.android.com/reference/android/text/ShowSecretsSetting#shouldShowTouchInput(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` Returns `true` when characters entered into a password, pin or other secret field from touch/virtual input sources should either be shown or echoed briefly. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public methods

### registerCallback

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Runnable registerCallback (Context context, 
                Runnable callback)
```

Registers a callback to be notified when show password settings change. The callback will be
invoked on the main thread.

See `https://developer.android.com/reference/android/text/ShowSecretsSetting#registerCallback(android.content.Context,%20java.util.concurrent.Executor,%20java.lang.Runnable)` regarding context lifetime
management.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The context used to access settings. This value cannot be `null`. <br /> |
| `callback` | `Runnable`: The callback to invoke. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Runnable` | A runnable that unregisters the callback when run. This value cannot be `null`. <br /> |

### registerCallback

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Runnable registerCallback (Context context, 
                Executor executor, 
                Runnable callback)
```

Registers a callback to be notified when show password settings change.

Note: To avoid unintentionally extending the lifetime of the provided context, the actual
observer registration is performed using the `https://developer.android.com/reference/android/content/Context#getApplicationContext()` (or a user-specific context derived from it), rather than holding a
strong reference to the provided `context`. However, the user ID of the provided `context` is preserved to ensure the correct user's settings are monitored. As a fallback, if
the application context is null (which typically only occurs in mocked contexts during tests
or during very early process initialization), the provided context is used directly. Callers
should ensure that in this fallback scenario, the provided context is not an Activity or
other short-lived context, as it may result in extending its lifetime indefinitely if the
returned runnable is kept alive.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The context used to access settings. This value cannot be `null`. <br /> |
| `executor` | `Executor`: The executor on which to invoke the callback. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `Runnable`: The callback to invoke. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Runnable` | A runnable that unregisters the callback when run. <br /> |

### shouldShowPhysicalInput

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean shouldShowPhysicalInput (Context context)
```

Returns `true` when characters entered into a password, pin or other secret field from
hardware/physical input sources should either be shown or echoed briefly.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### shouldShowTouchInput

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean shouldShowTouchInput (Context context)
```

Returns `true` when characters entered into a password, pin or other secret field from
touch/virtual input sources should either be shown or echoed briefly.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |