Pushing and Pulling, two ways to read a button
read a button when you want to
1. in MainActivity declare a veriable
2. in onCreate() link the vereble to the button
3. in loop() when needed see if the button is checked
private ToggleButton testButton_;
testButton_ = (ToggleButton)findViewById(R.id.testButton);
testButton_.isChecked()
do something when a button is pressed
private ToggleButton runButton_;
(onCreate())
runButton_ = (ToggleButton)findViewById(R.id.runButton);
runButton_.setOnClickListener(
new View.OnClickListener()
{
@Override
public void onClick(View v)
{
toast("button clicked");
}
}
);
make three buttons, each with it's own toast