I'm trying to modify another forum user's app that uses a toggle switch. The app in question turns on/off tethering. But no matter what state the phone is in, the toggle switch always starts in the "off" position. I'd like to modify the code to check the current status first, and then set the toggle to the correct position based on the status.

I've already got the code to check the status.

I found an app that does this. It's the devmodeswitcher app. When you start that app, if it's already in dev mode, then the app starts in the on position. If it's not, it starts in the off position.

That app appears to have a "configure" function. And that does the work of determining which position to start the toggle in. But I can't figure out how that function gets called. When creating the object, do the setup and configure functions just automatically get called?

For details on the example I'm looking at, see the following file on the Pre: