无法使用复选框(Android)

时间:2015-10-15 11:24:35

标签: android android-activity notifications push-notification android-vibration

我在MainActivity.class中使用Notification,并且我在另一个Settings.class中有复选框,我想在其中启用或禁用通知振动。一切正常,但当我取消选中复选框振动仍然保持,直到刷新或重新启动应用程序。我不想刷新活动或重新启动应用。

在主要班级:

@Override
public void onResume() {
    super.onResume();
            if(settingsAct.checkStatus1==1){
        notify.defaults |= notify.DEFAULT_VIBRATE;
    }
}

在“设置”类中:

if(mCheckVibrate.isChecked()){
        checkStatus1 = 1;
    }else{
        checkStatus1 = 0 ;
    }

1 个答案:

答案 0 :(得分:0)

最后,我已经解决了我的问题,我已经从默认通知振动更改为以下内容:

Framework7.$.ajax();

用于禁用我曾使用的振动:

vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
                        vibrator.vibrate(300);