switch preference to send an sms in code

view story

http://stackoverflow.com – I need some help with an android project I am working on. I am trying to use switch preferences to send a certain text. Basically, it the user switches the switch from off to on, I want the phone to send a text saying "on". Then when the user turns the switch from on to off, it sends a text saying "off". All I need is to be able to see what the current state of the switch is and then if it's off, call a "turn on" method and vice-versa. I've never asked a question like this, so I don't really know what part of my code to post.(If asked, I can post most of my code.) I think it has something to (HowTos)