Q:

Set Theme Not Working on Lower API Version

I want to set up the whole application theme. And my code is working fine in ICe-Creme Sandwich and higher, but it is not working on lower versions, not it is giving any errors.
Here is my code :
I am setting the theme using the below code before calling setcontentView();
SharedPreferences pref=context.getSharedPreferences(HomeSAFEPref.HomeSAFEPref,0);
        int position= pref.getInt("BackgroundPosition", 0);

        switch (position) {
        case 0:

            context.setTheme(R.style.Background0);

            break;

        case 1:

            context.setTheme(R.style.Background1);

            break;

        case 2:

            context.setTheme(R.style.Background2);

            break;

        case 3:
            context.setTheme(R.style.Background3);
            break;

        case 4:
            context.setTheme(R.style.Background4);
            break;
        }

The above code is working fine with higher versions, but is not working with lower ones.
Here is the styles code :
<style name="Background0" parent="@android:style/Theme.Black.NoTitleBar">
        <item name="android:windowBackground">@drawable/bigl_1</item>
        <item name="android:windowNoTitle">true</item>
    </style>

Please suggest

A:

You should set your theme before you call super.onCreate() and setContentView(). If it still doesn't work, then it is probably a problem with the framework.
Refer this and this.

