Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ToggleButton state change programmatically rather than automatically in Android?

I have created a custom class which extends ToggleButton and I override the toggle method and do not do anything in that. This has helped me in having control of switching togglebutton from on to off. Is this proper way of doing?

I wanted to have the control of togglebutton switching. I mean it should go from on to off based on certain conditions otherwise it should remain in the state it was.

This way its working but want to know whether its the correct way of doing or not.

like image 256
sunil Avatar asked Feb 18 '11 11:02

sunil


1 Answers

What you are looking for is ToggleButton.setChecked.

like image 76
user432209 Avatar answered Oct 22 '22 13:10

user432209