Code example for PreferenceGroup

Methods: getContext, addPreference

0
        super(p);
    } 
 
    @Override 
    protected void loadExtraPreferencesTo(PreferenceGroup subpanel) {
        Context c = subpanel.getContext();
        subpanel.addPreference(createEncryptionPreference(c));
 
        PptpProfile profile = (PptpProfile) getProfile();
    } 
 
    private Preference createEncryptionPreference(Context c) {
        final PptpProfile profile = (PptpProfile) getProfile();
        CheckBoxPreference encryption = mEncryption = new CheckBoxPreference(c);
        boolean enabled = profile.isEncryptionEnabled();
        setCheckBoxTitle(encryption, R.string.vpn_pptp_encryption_title);
        encryption.setChecked(enabled);
        setEncryptionSummary(encryption, enabled);
        encryption.setOnPreferenceChangeListener(
                new Preference.OnPreferenceChangeListener() {
                    public boolean onPreferenceChange(