Code example for AtomicBoolean

0
import android.widget.Switch; 
 
public class SwitchWidget implements CompoundButton.OnCheckedChangeListener {
    public static Context mContext;
    public Switch mSwitch;
    public AtomicBoolean mConnected = new AtomicBoolean(false);
 
    public boolean mStateMachineEvent;
 
    /* 
     * public SwitchWidget(Context context, Switch switch_) { super(context, 
     * switch_); mContext = context; mSwitch = switch_; } 
     */ 
    public SwitchWidget() { 
    } 
 
    public void resume() { 
        mSwitch.setOnCheckedChangeListener(this);
    } 
 
    public void pause() {