我想使用上面提到的类,并想从它们的静态常量中检索信息。我想检索这样的信息。例如来自 Settings.Secure
SETTINGS_SECURE
ADB_ENABLED=1
ALLOWED_GEOLOCATION_ORIGINS=http://www.google.co.uk
ALLOW_MOCK_LOCATION=0
ANDROID_ID=200142d4dfd4e641
但我实际上得到了这个输出:
SETTINGS_SECURE
ADB_ENABLED=adb_enabled
ALLOWED_GEOLOCATION_ORIGINS=allowed_geolocation_origins
ALLOW_MOCK_LOCATION=allow_mock_location
ANDROID_ID=android_id
有什么建议吗?
最佳答案
看起来您只是在检索常量的值。作为一个简单的例子来说明差异,产生上述输出:
StringBuilder sb = new StringBuilder("SETTINGS_SECURE\n");
sb.append(Settings.Secure.ADB_ENABLED.toUpperCase())
.append("=")
.append(Settings.Secure.getString(getContentResolver(),
Settings.Secure.ADB_ENABLED))
.append("\n")
.append(Settings.Secure.ALLOWED_GEOLOCATION_ORIGINS.toUpperCase())
.append("=")
.append(Settings.Secure.getString(getContentResolver(),
Settings.Secure.ALLOWED_GEOLOCATION_ORIGINS))
.append("\n")
.append(Settings.Secure.ALLOW_MOCK_LOCATION.toUpperCase())
.append("=")
.append(Settings.Secure.getString(getContentResolver(),
Settings.Secure.ALLOW_MOCK_LOCATION))
.append("\n")
.append(Settings.Secure.ANDROID_ID.toUpperCase())
.append("=")
.append(Settings.Secure.getString(getContentResolver(),
Settings.Secure.ANDROID_ID));
关于java - 如何在Android中使用Settings.Global、Settings.Secure和Settings.System?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22496157/