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

# ShowSecretsSetting

*** ** * ** ***

```
class ShowSecretsSetting
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.text.ShowSecretsSetting](https://developer.android.com/reference/kotlin/android/text/ShowSecretsSetting#) |

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 [Runnable](https://developer.android.com/reference/kotlin/java/lang/Runnable.html#) | `https://developer.android.com/reference/kotlin/android/text/ShowSecretsSetting#registerCallback(android.content.Context,%20java.lang.Runnable)(context: https://developer.android.com/reference/kotlin/android/content/Context.html#, callback: https://developer.android.com/reference/kotlin/java/lang/Runnable.html#)` Registers a callback to be notified when show password settings change. |
| static [Runnable](https://developer.android.com/reference/kotlin/java/lang/Runnable.html#) | `https://developer.android.com/reference/kotlin/android/text/ShowSecretsSetting#registerCallback(android.content.Context,%20java.util.concurrent.Executor,%20java.lang.Runnable)(context: https://developer.android.com/reference/kotlin/android/content/Context.html#, executor: https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html#, callback: https://developer.android.com/reference/kotlin/java/lang/Runnable.html#)` Registers a callback to be notified when show password settings change. |
| static [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/text/ShowSecretsSetting#shouldShowPhysicalInput(android.content.Context)(context: https://developer.android.com/reference/kotlin/android/content/Context.html#)` 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://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/text/ShowSecretsSetting#shouldShowTouchInput(android.content.Context)(context: https://developer.android.com/reference/kotlin/android/content/Context.html#)` 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. |

## Public methods

### registerCallback

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

```
static fun registerCallback(
    context: Context, 
    callback: Runnable
): Runnable
```

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/kotlin/android/text/ShowSecretsSetting#registerCallback(android.content.Context,%20java.util.concurrent.Executor,%20java.lang.Runnable)` regarding context lifetime management.

| Parameters ||
|---|---|
| `context` | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#): The context used to access settings. This value cannot be `null`. |
| `callback` | [Runnable](https://developer.android.com/reference/kotlin/java/lang/Runnable.html#): The callback to invoke. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/java/lang/Runnable.html#` | A runnable that unregisters the callback when run. This value cannot be `null`. |

### registerCallback

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

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

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/kotlin/android/content/Context.html#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.

| Parameters ||
|---|---|
| `context` | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#): The context used to access settings. This value cannot be `null`. |
| `executor` | [Executor](https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html#): 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/kotlin/java/util/concurrent/Executor.html#`, 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/kotlin/android/content/Context.html#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html#` that dispatches to an appropriate thread. |
| `callback` | [Runnable](https://developer.android.com/reference/kotlin/java/lang/Runnable.html#): The callback to invoke. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/java/lang/Runnable.html#` | A runnable that unregisters the callback when run. |

### shouldShowPhysicalInput

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

```
static fun shouldShowPhysicalInput(context: Context): Boolean
```

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.

| Parameters ||
|---|---|
| `context` | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#): This value cannot be `null`. |

### shouldShowTouchInput

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

```
static fun shouldShowTouchInput(context: Context): Boolean
```

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.

| Parameters ||
|---|---|
| `context` | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#): This value cannot be `null`. |