I know how to set theme to whole application in manifest,but how to set theme to whole application programmatically ? I am trying this: getApplicationContext.se
I use a custom activity for all activities in my application.
Then I check a preference value in the onCreate of my inherited activity e.g.
public class MyCustomActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(this);
if(prefs.getBoolean("use_light_theme",false)==true)
{
setTheme(R.style.AppThemeLight);
}
super.onCreate(savedInstanceState);
}
//styles.xml