How to not check a checkbox when touch
<p>I have a checkbox that is switching state on touch. I am wanting to find out how to ignore the state switch on touch. I have an onClickListener attached to the checkbox and inside of that I am changing the state with "Yes" or "No" buttons.</p>

<pre><code>        if(sog.isChecked()){
                sog.setChecked(false);
        } else {
                sog.setChecked(true);
        }
</code></pre>

<p>Edit: The checkbox is switching when touched and my yes button is also changing state.</p>

<p>Edit 2: I want my dialog to change the state rather than the checkbox doing it on it's own.</p>

<p>Edit 3:</p>

<pre><code>        sog.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            showDialog(3);

        }
    });

builder.setTitle("Checkbox")
        .setMessage(
                "Are you sure you want to switch checkbox?")
                .setPositiveButton("Yes",
                        new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                            int id) {
                        if(sog.isChecked()){
                            sog.setChecked(false);
                        } else {
                            sog.setChecked(true);
                            setTotalTime();
                        }
                    }
                })
                .setNegativeButton("No",
                        new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                            int id) {
                        dialog.cancel();
                    }
                });
        AlertDialog alert = builder.create();
        return alert;
</code></pre>
