@Override
public void onMyClick(int btnNo) {
if (btnNo == AlternativeControl.BTNONE) {//开
mSetupUI.SetBeepSound(SetupSoundActivity.this,SetupSoundActivity.this.getContentResolver(),true);//开
}else if (btnNo == AlternativeControl.BTNTWO) {//关
mSetupUI.SetBeepSound(SetupSoundActivity.this,SetupSoundActivity.this.getContentResolver(),false);//关
}
beepAdjust.updateBtnStatus(btnNo);
}
/*
SetBeepSound:按键音开关
bBeep:TRUE-开,FALSE-关
*/
public void SetBeepSound(Context context,ContentResolver cr, boolean bBeep)
{
AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
if(bBeep)
{
mAudioManager.loadSoundEffects();
Settings.System.putInt(cr, Settings.System.SOUND_EFFECTS_ENABLED,
1);
}
else
{
mAudioManager.unloadSoundEffects();
Settings.System.putInt(cr, Settings.System.SOUND_EFFECTS_ENABLED,
0);
}
}
/**获取按键音状态 0 关闭 1 开*/
public int GetBeepSound(ContentResolver cr){
int beepSound = Settings.System.getInt(cr,
Settings.System.SOUND_EFFECTS_ENABLED, 0);
return beepSound;
}
android之设置按键音2014.10.31
最新推荐文章于 2024-07-08 03:04:05 发布