How do I pass a value from a class to a button?

I think what I am looking for is a way to switch the button from on to off when the button number is selected. then the user pushes the button to reset it to on. Does that make sense? I am pretty new to the process of creating an android application. Thank you in advance for your help.