Reputation: 784
I am trying to change Theme of my application on button
click. I have defined an onClick()
function in my Activity
.
My code:
public class Screen2 extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.secondscreen);
}
public void theme(View view){
getApplication().setTheme(android.R.style.Theme_Holo);
}
It doesn't work. Could you please help me to change theme of my application?
Thanks in Advance.
Upvotes: 3
Views: 4647
Reputation: 21191
Here is the nice tutorial for changing the theme on Button click
and also Here is the tutorial for the Styling Android With Defaults
Upvotes: 4