FileDocCategorySizeDatePackage
BluetoothNamePreference.javaAPI DocAndroid 1.5 API3056Wed May 06 22:42:48 BST 2009com.android.settings.bluetooth

BluetoothNamePreference

public class BluetoothNamePreference extends android.preference.EditTextPreference
BluetoothNamePreference is the preference type for editing the device's Bluetooth name. It asks the user for a name, and persists it via the Bluetooth API.

Fields Summary
private static final String
TAG
private LocalBluetoothManager
mLocalManager
private android.content.BroadcastReceiver
mReceiver
Constructors Summary
public BluetoothNamePreference(android.content.Context context, android.util.AttributeSet attrs)

    
         
        super(context, attrs);
        
        mLocalManager = LocalBluetoothManager.getInstance(context);
        
        setSummaryToName();        
    
Methods Summary
public voidpause()

        getContext().unregisterReceiver(mReceiver);
    
protected booleanpersistString(java.lang.String value)

        BluetoothDevice manager = mLocalManager.getBluetoothManager();
        manager.setName(value);
        return true;        
    
public voidresume()

        IntentFilter filter = new IntentFilter();
        filter.addAction(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION);
        filter.addAction(BluetoothIntent.NAME_CHANGED_ACTION);
        getContext().registerReceiver(mReceiver, filter);
    
private voidsetSummaryToName()

        BluetoothDevice manager = mLocalManager.getBluetoothManager();
        if (manager.isEnabled()) {
            setSummary(manager.getName());
        }