问题描述
BY THE WAY这个线程已经SOVLED BY ME,及其与CDR的帮助。鲍威尔......请参阅下面的编辑岗位
我在这里有这个code
I have this code here
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);
}
}
});
我要跟踪如果其打开或关闭..但是当我登录的东西logcat的,其中其打开或关闭它不会做任何事情。我不知道什么是错的Cuz我的其他code一样,语法,但它的工作原理我只是复制粘贴,改变只有切换按钮变量。
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.
所以,我观察到,与CDR的帮助。鲍威尔当然,当u把这个code座,我已经发布了,在另一个匿名的听众之一,说侦听器保存按钮,该checkOnChangedListener坏了,它不会在另一个匿名监听功能很好,但有一件事,我不明白的是,也有我的code一外监听器,它就像一个按钮,显示一个对话框,该对话框里面,有打开另一个对话框添加按钮盒子里面有那个开关按钮和另一个按钮用于节省或增加其关闭该对话框,并返回到previous对话框随后将显示新添加的记录,所以有人对你有一个想法,为什么它当我把它坏了一个监听器里面保存按钮,但在外部监听器工作正常。
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.
推荐答案
所以,我观察到,与CDR的帮助。鲍威尔当然,当u把这个code座,我已经发布了,在另一个匿名的听众之一,说侦听器保存按钮,该checkOnChangedListener坏了,它不会在另一个匿名监听功能很好,但有一件事,我不明白的是,也有我的code一外监听器,它就像一个按钮,显示一个对话框,该对话框里面,有打开另一个对话框添加按钮盒子里面有那个开关按钮和另一个按钮用于节省或增加其关闭该对话框,并返回到previous对话框随后将显示新添加的记录,所以有人对你有一个想法,为什么它当我把它坏了一个监听器里面保存按钮,但在外部监听器工作正常。
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.
这篇关于安卓:切换按钮监听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!