0

I am trying to set light mode if the default mode is dark mode in my Intro Activity

Intro.java

if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO)
{
    AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
    this.recreate();
}

But this throws an error:

2020-10-25 07:04:43.626 9167-9167/com.xxxx.xxxxxx E/ActivityInjector: get life cycle exception
    java.lang.ClassCastException: android.os.BinderProxy cannot be cast to android.app.servertransaction.ClientTransaction

I am using

Theme.AppCompat.DayNight.NoActionBar

Also the theme doesn't update in the Activity. If anyone knows please help me out on this.

Ayush
  • 1,226
  • 1
  • 8
  • 18
  • Answered the Question Over Here [Click me :) ](https://stackoverflow.com/questions/64565156/miui-11-12-theme-switch-results-in-lifecycleexception-classcastexception) – Ayush Nov 04 '20 at 11:26
  • @RyanM yea, somewhat, since the app works fine one emulator without crashing. i suppose its a rom specific issue. – Ayush Nov 11 '20 at 04:02

0 Answers0