I have a change theme option in setting screen of my application and providing some custom themes to choose from .
first of all i believe you can’t set theme to entire app from your java code at once (please guide if there is any way to do so ) , thats why i am calling setTheme(my_theme) before super.onCreate() in every activity of app .
Now when user change activity, this will reflect only at the time of relaunching any activity (becouse setTheme() is in OnCreate() ).
So issue is how to let SetTheme() works in OnResume() or anywhere else in code , because i want to reflect these changes on previous screens in Activity Stack also .
note that setTheme() works before setContentVIew() only ……
Yeah, as the docs say, you need to set the theme before any views are instantiated, so it looks like you will need to restart your entire activity.
There’s probably a better way, but one way to ensure your activities completely restart in onResume():
This will recycle the existing intent. However, I would first look around to see if there is a simpler way to ensure activities restart- might be a simple manifest property. Let us know what you find.