是否可以以编程方式获取Android中的各种触摸设置,如:
->拨号盘触控音
->触觉音
->屏幕锁定声
->触控振动
我尝试过访问System.Settings中的各种常量,但没有提到用于触摸设置的常量。有人能为我提供API或常量的信息吗?
发布于 2014-03-21 12:55:48
使用以下方法检查
->拨号盘触摸音调:
boolean isDtmfToneEnabled = Settings.System.getInt(contentResolver,
Settings.System.DTMF_TONE_WHEN_DIALING, 1) != 0;->触摸声音:
boolean isTouchSoundsEnabled = Settings.System.getInt(contentResolver,
Settings.System.SOUND_EFFECTS_ENABLED, 1) != 0;->屏幕锁定声音:
boolean islockScreenSoundsEnabled = Settings.System.getInt(contentResolver,
"lockscreen_sounds_enabled", 1) != 0;->触控振动:
boolean isVibrateOnTouchEnabled = Settings.System.getInt(contentResolver,
Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0;您可以使用putInt() API来更改它们的值。希望这能有所帮助。
发布于 2014-09-16 09:03:56
禁用振动触点:
boolean isVibrateOnTouchEnabled = Settings.System.getInt(getContentResolver(),
Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0;
if(isVibrateOnTouchEnabled) {
Settings.System.putInt(getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 0);
Toast.makeText(MainActivity.this, "Vibration touch Off", Toast.LENGTH_SHORT).show();
}发布于 2014-09-16 09:05:22
禁用屏幕锁定声音:
boolean islockScreenSoundsEnabled = Settings.System.getInt(getContentResolver(),
"lockscreen_sounds_enabled", 1) != 0;
if(islockScreenSoundsEnabled) {
Settings.System.putInt(getContentResolver(),"lockscreen_sounds_enabled", 0);
}https://stackoverflow.com/questions/22557816
复制相似问题