錯誤代碼是:
07-07 08:34:19.693 11797-11809 E/JavaBinder﹕
*** Uncaught remote exception! (Exceptions are not yet supported
across processes.)
android.util.AndroidRuntimeException: { what=102 when=-22ms
obj=android.os.BinderProxy@4218d598 } This message is already in
use.
我現在不能很肯定是哪裡的消息使用錯誤,請大神們幫我看看這段代碼有沒有錯誤
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_alarm);
ctext = this;
CfgLooper = Looper.myLooper();
CfgHandler = new CfgHandler(CfgLooper);
show_alarm();
}
public class CfgHandler extends Handler {
public CfgHandler(Looper looper) {
super(looper);
}
public void handleMessage(Message msg) {
switch (msg.what) {
case comm_frame.SYS_CFG_RSP_FRM:
sys_cfg_rsp sys_cfg_rsp_info;
sys_cfg_rsp_info = (sys_cfg_rsp) msg.obj;
if (sys_cfg_rsp_info.child_type == comm_frame.SYS_CFG_TYPE_ALARM) {
new AlertDialog.Builder(ctext).setTitle("完成")
.setMessage("設置成功")
.setPositiveButton("確定", null).show();
}
break;
case comm_frame.EVENT_RSP_FRM:
event_info_rsp_class event_info_rsp;
event_info_rsp = (event_info_rsp_class) msg.obj;
comm_frame.invokeLongTimeToast(event_info_rsp, ctext);
break;
}
}
}
show_alarm()是4個check_box。
請教下是不是這段代碼有錯誤呢?
應該在發消息的代碼中,每次發消息的時候,都要new 一個 Message對象,或者調用hander的obtainMessage