Irshad Khan
Irshad Khan

Reputation: 784

I want to change the theme of my whole application

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

Answers (1)

Ram kiran Pachigolla
Ram kiran Pachigolla

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

Related Questions