Code example for BluetoothAdapter: Communicating over Bluetooth

Methods: cancelDiscovery, isDiscovering, startDiscovery

0
        // Indicate scanning in the title 
        setProgressBarIndeterminateVisibility(true);
        setTitle("scanning for devices...");
 
        // If we're already discovering, stop it 
        if (mBluetoothAdapter.isDiscovering()) {
            mBluetoothAdapter.cancelDiscovery();
        } 
 
        // Request discover from BluetoothAdapter 
        mBluetoothAdapter.startDiscovery();
    } 
 
    // The on-click listener for all devices in the ListViews 
    private OnItemClickListener mDeviceClickListener = new OnItemClickListener() {
        public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) { 
        	// Cancel discovery because it will slow down the connection 
            mBluetoothAdapter.cancelDiscovery(); 
 
            // Get the device MAC address, which is the last 17 chars in the View 
            String info = ((TextView) v).getText().toString();