如何以编程方式查询,获取和Android手机设置触摸设置? [英] How to programmatically check, get and set touch settings in android phones?

查看:384
本文介绍了如何以编程方式查询,获取和Android手机设置触摸设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能以编程方式获得Android上的各种触摸设置,如:

Is it possible to programmatically get the various touch settings in Android such as:

- >拨号键盘触摸音效

-> Dial pad touch tones

- >触摸声音

- >屏幕锁定声音

-> Screen lock sound

- >触摸振动

我曾尝试在System.Settings访问各种常数,但我看到没有提及的触摸设置常量。任何人都可以向我提供的API或常量的信息,我可以用这个?

I have tried accessing the various constants in System.Settings, but I see no mention of constants for the touch settings. Can anyone provide me with info on the APIs or constants I could use for this?

推荐答案

使用下面的检查

- >拨号键盘触摸音效:

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;

您可以使用<一个href=\"https://developer.android.com/reference/android/provider/Settings.System.html#putInt%28android.content.ContentResolver,%20java.lang.String,%20int%29\"相对=nofollow> putInt()API 来改变它们的值。
希望这有助于。

You can use putInt() API to change their values. Hope this helps.

这篇关于如何以编程方式查询,获取和Android手机设置触摸设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆