Code example for ToggleButton

Methods: setEnabled, getId, isChecked

0
     
    public class ButtonClickListener implements View.OnClickListener {
 
        public void onClick(View v) {
            // TODO Auto-generated method stub 
            if (v.getId() == mToggleButton.getId()) {
                mToggleButton.setEnabled(false);
                if (mToggleButton.isChecked()) {
                    mState = true;
                    if (!mThread.isAlive()) {
                        mThread.start();
                    } 
                    Elog.i(TAG, "mSDLogToggleButton is checked");
                } else { 
                    mState = false;
                    Elog.i(TAG,
                            "mSDLogToggleButton is unchecked"); 
                } 
                mToggleButton.setEnabled(true);
            } 
        } 
    } 
 
    private void checkSDCard() {