UiModeManager.NightMode Property
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.
Returns the currently configured night mode. -or- Sets the system-wide night mode.
public virtual Android.App.UiNightMode NightMode { [Android.Runtime.Register("getNightMode", "()I", "GetGetNightModeHandler")] get; [Android.Runtime.Register("setNightMode", "(I)V", "GetSetNightMode_IHandler")] set; }
[<get: Android.Runtime.Register("getNightMode", "()I", "GetGetNightModeHandler")>]
[<set: Android.Runtime.Register("setNightMode", "(I)V", "GetSetNightMode_IHandler")>]
member this.NightMode : Android.App.UiNightMode with get, set
Property Value
the current night mode, or -1 on error
- Attributes
Remarks
Returns the currently configured night mode.
May be one of:
Setting this property changes the system-wide night mode. No selects notnight, Yes selects night, Custom switches according to the custom or default schedule, and Auto switches according to location and other sensors.
On API 22 and earlier, night mode changes take effect only in car or desk mode. On API 23 through API 28, they are not limited to those modes.
Starting in API 29, a night mode change made in car mode is not persisted. The previously persisted setting is restored when the device exits car mode.
System-wide night mode changes can cause a configuration change, which can trigger activity lifecycle events. To set and persist the night qualifier for one application, use SetApplicationNightMode(Int32). For backward compatibility, consider AppCompatDelegate.setDefaultNightMode(int).
Android reference for android.app.UiModeManager.getNightMode.
Java documentation for android.app.UiModeManager.setNightMode(int).
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.