Android: ToggleButton Listener
<p><strong>BY THE WAY THIS THREAD IS ALREADY SOVLED BY ME, AND WITH THE HELP OF CDR. POWELL... please refer to the edited post below</strong></p>

<p>I have this code here</p>

<pre><code>ToggleButton toggleAlarm = (ToggleButton) d.findViewById(R.id.toggle_alarm);

toggleAlarm.setOnCheckedChangeListener(new OnCheckedChangeListener() {

    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

        if(isChecked)
        {
            Log.d("alarmCheck","ALARM SET TO TRUE");
            sched.setAlarm(true);
        }
        else
        {
            Log.d("alarmCheck","ALARM SET TO FALSE");
            sched.setAlarm(false);
        }
    }
});
</code></pre>

<p>I have to keep track if its ON or OFF.. but when i logged something to logcat where its on or off it wont do a thing.. i dunno whats wrong cuz on my other code same, syntax but it works i just copy paste it and change only the ToggleButton variable.</p>

<h2><strong>EDIT</strong></h2>

<p>So i have observed, with the help of cdr. powell of course, that when u put this code block, the one that i have posted, inside another anonymous listener, say listener for a save button, the checkOnChangedListener is broken, it doesn't function well inside another anonymous listener, but the one thing that i don't understand is that, there is also a outer listener in my code, its like a button to display a dialog box and inside that dialog box, there is an add button that opens another dialog box which has that toggle button and another button for save or add which closes that dialog and returns to the previous dialog which will then display the newly added record, so anyone of you have an idea why is it broken when i put it inside a listener for a save button but works fine in a outer listener.</p>
