Reputation: 11565
Is it possible to override colorPrimary , colorPrimaryDark and colorAccent
values Programatically and change Accordingly from java code at Runtime ? If Possible please help.
Upvotes: 1
Views: 933
Reputation: 2427
No, it's not possible. But you can create multiple Styles and change the Style used by the activity at runtime. To do that use setTheme()
before calling setContentView()
and super.onCreate()
method inside onCreate()
method of the activity!
public void onCreate(Bundle savedInstanceState) {
setTheme(R.style.MyTheme); // (for Custom theme)
super.onCreate(savedInstanceState);
this.setContentView(R.layout.myactivity);
}
Upvotes: 2