I have 1 PreferenceActivity
in preferences.xml is
<CheckBoxPreference
android:id="@+id/pushCB"
android:checked="true"
android:defaultValue="true"
android:key="PushService"
android:summary="Set to enable push service for ..."
android:title="Use Push Service" >
</CheckBoxPreference>
and in PreferenceActivity i have
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.preferences);
final CheckBox pushServiceCB = (CheckBox) findViewById(R.id.pushCB);
pushServiceCB.setChecked(Dynamic_Value);
}
but nothing happen. Why? and how can i fix this?
thanks in advance
I believe you should use final CheckBoxPreference pushServiceCB = (CheckBoxPreference) findPreference ("PushService");
to get that object.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.