Skip to content Skip to sidebar Skip to footer

Android - How To Update The Theme Not In The Oncreate Event?

In my android app, I set the theme like this: @Override public void onCreate(Bundle savedInstanceState){ ThemeSetterActivity.setStyle(Main_MenuActivity.this); // this just call

Solution 1:

To change the theme of your application during run time, you can use the setTheme(...) method within the activity. You must set the theme to an activity, before loading the views of that activity.

For more info and implementation, refer the link:

Updated

And, as per the docs to set theme you need to restart the entire activity. You can try this code in onResume() of your activity,

Intenti= getIntent();
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);

Post a Comment for "Android - How To Update The Theme Not In The Oncreate Event?"