一开始,我的应用程序将关于复选框首选项的首选项设置为“真”。现在我需要以编程方式设置此值 (android:enabled="true") 或 false。任何的想法?
protected void checkLicense(){
PackageManager manager = getPackageManager();
if (manager.checkSignatures("core.package.name", "key.package.name")
== PackageManager.SIGNATURE_MATCH) {
//full version
isEnabled = true;
Toast.makeText(this, "pro", Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(this, "free", Toast.LENGTH_LONG).show();
isEnabled = false;
<CheckBoxPreference
android:enabled="true"
android:title="Now"
android:defaultValue="false"
android:key="keep" />