I have found many questions related to this but my problem is a little bit different.

From SettingActivity, I enable/disable the nigh mode through the following code:

```
ApplicationClass.setNightMode();
ApplicationClass.setDayMode();

```

Actuall code written in application class.

But when I return back to MainActivity from SettingActivity the color does not change of layout because of onCreate() method do not call.

How can I recreate the MainActivity from SettingActivity when I enable/disable night mode.

My Application code from where I enable and disable night mode:

```
    public static void setNightMode(){
        AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
    }

    public static void setDayMode(){
        AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
    }

```