Get back the old drawable in Compound button?

328 Views Asked by At

How to remove the current drawable and go to old drawable state;

RadioButton radioButton = (RadioButton) findViewById(R.id.opt1);
radioButton.setButtonDrawable(R.drawable.ic_done);

For the next question, it should go to the old drawable.

So I have tried radioButton.setButtonDrawable(0) but it removed the drawable. Is there any way to getDefaultDrawable() according to Theme.AppCompat?

1

There are 1 best solutions below

2
Bugs Happen On

You can do something like this:

Before changing background

RadioButton radioButton;
Drawable defaultRadioButtonBackground = radioButton.getBackground();

When you want to change back to default background

radioButton.setBackground(defaultRadioButtonBackground);