I'm using this simple function to get dark mode. I store a boolean value in shared preferences. And If value doesn't exist, I return false for default.
This is my simple code:
public static boolean getNightMode(){
SharedPreferences pref = getApplicationContext().getSharedPreferences("nightMode", 0);
return pref.getBoolean("nightMode",false);
}
Now instead of returning false for default, ı would like to return system dark mode status.
I mean if system using dark mode, return true.
How can I achive this?