1

I'm beginner of android app development. I have an android app with dark mode in it and the dark mode does not work for android version below 8. So i want to add a code which detects the android version of the phone and gives a toast msg or disables the switch which toggles dark mode. So how can i make it?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

1 Answers1

0

You can use the Build.VERSION class

    val release = Build.VERSION.RELEASE  //Version 11
    val sdkVersion = Build.VERSION.SDK_INT  //30

    Toast.makeText(this, "Version:$release SDK:$sdkVersion",Toast.LENGTH_LONG).show()
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841