title: Setting DayNight theme using AppCompatDelegate.setDefaultNightMode() not working for FragmentActivity
body: <p>I'm a bit puzzled. I'm using a DayNight theme in my app (using <code>AppCompatDelegate.setDefaultNightMode()</code>), but can't get it to work in my <code>MainActivity</code>. 
  The <code>MainActivity</code> (which extends <code>FragmentActivity</code>) looks like it's never set to dark theme - <strong>it always remains in light theme</strong>. </p>
  
  <p>I tried setting the theme directly in my MainActivity:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
      super.onCreate(savedInstanceState);
      // create main activity.
  }
  </code></pre>
  
  <p>But this is not working. </p>
  
  <p>I have set all of the colors in my layout files properly using ?attr/colorReference. Does anyone know what is going wrong here?</p>
  
  <p><strong>EDIT:</strong>
  My styles.xml is as follows:</p>
  
  <pre><code>&lt;style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar"&gt;
      &lt;!--Default typeface and colors:--&gt;
      &lt;item name="android:typeface"&gt;monospace&lt;/item&gt;
      &lt;item name="colorPrimary"&gt;@color/colorPrimary&lt;/item&gt;
      &lt;item name="colorPrimaryDark"&gt;@color/colorPrimaryDark&lt;/item&gt;
      &lt;item name="colorAccent"&gt;@color/colorAccent&lt;/item&gt;
      &lt;item name="colorAccentDarker"&gt;@color/colorAccentDarker&lt;/item&gt;
      &lt;item name="colorAccentDarker_80percent"&gt;@color/colorAccentDarker_80percent&lt;/item&gt;
  
      &lt;!--Show people's own wallpaper background--&gt;
      &lt;item name="android:windowShowWallpaper"&gt;true&lt;/item&gt;
      &lt;item name="android:windowBackground"&gt;@android:color/transparent&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>