when (this.resources?.configuration?.uiMode?.and(Configuration.UI_MODE_NIGHT_MASK)) {
Configuration.UI_MODE_NIGHT_YES -> {
//write code here for night mode
}
Configuration.UI_MODE_NIGHT_NO -> {
//write code here for light mode
}
Configuration.UI_MODE_NIGHT_UNDEFINED -> {
//write code here when undefined
}
}
color mode
The code sets the mode of the user interface to either night mode or light mode, depending on the value of the resource's configuration.uiMode property.
0 Comments
Add Comment
Log in to add a comment