Code example for PreferenceGroup

Methods: addPreference

0
    void createDevicePreference(CachedBluetoothDevice cachedDevice) {
        BluetoothDevicePreference preference = new BluetoothDevicePreference(
                getActivity(), cachedDevice);
 
        initDevicePreference(preference);
        mDeviceListGroup.addPreference(preference);
        mDevicePreferenceMap.put(cachedDevice, preference);
    } 
 
    /** 
     * Overridden in {@link BluetoothSettings} to add a listener. 
     * @param preference the newly added preference 
     */ 
    void initDevicePreference(BluetoothDevicePreference preference) {
        // Does nothing by default 
    } 
 
    public void onDeviceDeleted(CachedBluetoothDevice cachedDevice) {
        BluetoothDevicePreference preference = mDevicePreferenceMap.remove(cachedDevice);
        if (preference != null) {
            mDeviceListGroup.removePreference(preference);