ShowSecretsSetting.RegisterCallback Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| RegisterCallback(Context, IRunnable) |
Registers a callback to be notified when show password settings change. |
| RegisterCallback(Context, IExecutor, IRunnable) |
Registers a callback to be notified when show password settings change. |
RegisterCallback(Context, IRunnable)
Registers a callback to be notified when show password settings change.
[Android.Runtime.Register("registerCallback", "(Landroid/content/Context;Ljava/lang/Runnable;)Ljava/lang/Runnable;", "", ApiSince=37)]
public static Java.Lang.IRunnable RegisterCallback(Android.Content.Context context, Java.Lang.IRunnable callback);
[<Android.Runtime.Register("registerCallback", "(Landroid/content/Context;Ljava/lang/Runnable;)Ljava/lang/Runnable;", "", ApiSince=37)>]
static member RegisterCallback : Android.Content.Context * Java.Lang.IRunnable -> Java.Lang.IRunnable
Parameters
- context
- Context
The context used to access settings.
- callback
- IRunnable
The callback to invoke.
Returns
A runnable that unregisters the callback when run.
- Attributes
Remarks
Registers a callback to be notified when show password settings change. The callback will be invoked on the main thread.
See registerCallback(Context,Executor,Runnable) regarding context lifetime management.
Android reference for android.text.ShowSecretsSetting.registerCallback.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
RegisterCallback(Context, IExecutor, IRunnable)
Registers a callback to be notified when show password settings change.
[Android.Runtime.Register("registerCallback", "(Landroid/content/Context;Ljava/util/concurrent/Executor;Ljava/lang/Runnable;)Ljava/lang/Runnable;", "", ApiSince=37)]
public static Java.Lang.IRunnable RegisterCallback(Android.Content.Context context, Java.Util.Concurrent.IExecutor executor, Java.Lang.IRunnable callback);
[<Android.Runtime.Register("registerCallback", "(Landroid/content/Context;Ljava/util/concurrent/Executor;Ljava/lang/Runnable;)Ljava/lang/Runnable;", "", ApiSince=37)>]
static member RegisterCallback : Android.Content.Context * Java.Util.Concurrent.IExecutor * Java.Lang.IRunnable -> Java.Lang.IRunnable
Parameters
- context
- Context
The context used to access settings.
- executor
- IExecutor
The executor on which to invoke the callback.
- callback
- IRunnable
The callback to invoke.
Returns
A runnable that unregisters the callback when run.
- Attributes
Remarks
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 application context (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.
Android reference for android.text.ShowSecretsSetting.registerCallback.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.