When my android app run, there is a button or something which let customers to select a color to show on primarycolordack, colorprimary and so on. in others words, i want to change app theme. how to do that?
Asked
Active
Viewed 85 times
1
-
Restart Activity and set theme before Activity.onCreate(). This answer may helps http://stackoverflow.com/a/11576546/5183999 – nshmura Aug 13 '16 at 06:10
1 Answers
1
Lucky for you android mead it simple, there is a method for that inside the activity class:
setTheme(android.R.style.MyTheme);
You'll have to call this method inside on create before the super command like this:
public void onCreate(Bundle savedInstanceState) {
setTheme(android.R.style.MyTheme);
super.onCreate(savedInstanceState)
}

Nir Duan
- 6,164
- 4
- 24
- 38