@Override protected void onResume() { super.onResume(); cb_show_Switch.setChecked(isShow); cb_show_Switch.setOnCheckedChangeListener(this); switch_type = GTPref.getGTPref().getInt(GTPref.AC_SWITCH, GW); switch (switch_type) { case PROFILER: { show_profiler.setChecked(true); break; } case GW: default: { show_gw.setChecked(true); break; } } // 监听放在上面初始setChecked后面,避免提前触发监听造成逻辑混乱 this.show_quickswitch.setOnCheckedChangeListener(new OnCheckedChangeListenerImp()); }
@Override protected void onPause() { super.onResume(); cb_show_Switch.setOnCheckedChangeListener(null); this.show_quickswitch.setOnCheckedChangeListener(null); }