Q:

How to set a custom color to WindowBackground

I want to know how I can to set a custom color because when I put a color background in lollipop theme this say me to this color is not allowed. 
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">#FF0099</item>

    <!-- colorPrimaryDark is used for the status bar -->
    <item name="colorPrimaryDark">#FF0099</item>

    <!-- colorAccent is used as the default value for colorControlActivated,
     which is used to tint widgets -->
    <item name="colorAccent">#339900</item>
    <item name="android:textColorPrimary">#FFFFFF</item>

    <item name="android:windowBackground">#f06292</item>

    <!-- You can also set colorControlNormal, colorControlActivated
     colorControlHighlight, and colorSwitchThumbNormal. -->

</style>

</resources>

And I have the issue to say me error: Error: Color types not allowed (at 'android:windowBackground' with value '#f06292'). I don't know what I must do.
And a last thing is to how can to call to all this function from code. 

A:

Try using color as resource. So define it inside your strings xml file (or add your own colors xml file) like this:
<color name="yourcolor">#f06292</color>

and then change your error line to the following:
<item name="android:windowBackground">@color/yourcolor</item>

