setLocalNightMode

abstract fun setLocalNightMode(mode: Int)(source)

Override the night mode used for this delegate's host component.

When setting a mode to be used across an entire app, the setDefaultNightMode method is preferred.

If this is called after the host component has been created, a uiMode configuration change will occur, which may result in the component being recreated.

It is not recommended to use this method on a delegate attached to a Dialog. Dialogs use the host Activity as their context, resulting in the dialog's night mode overriding the Activity's night mode.

Note: This method is not recommended for use on devices running SDK 16 or earlier, as the specified night mode configuration may leak to other activities. Instead, consider using setDefaultNightMode to specify an app-wide night mode.

See also