private void doDiscovery() {
        if (D) Log.d(TAG, "doDiscovery()");
        
        // Remove all element from the list
        mPairedDevicesArrayAdapter.clear();
        
        // If there are paired devices, add each one to the ArrayAdapter
        if (pairedDevices.size() > 0) {
            for (BluetoothDevice device : pairedDevices) {
                mPairedDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress());
            }
        } else {
            String strNoFound = getIntent().getStringExtra("no_devices_found");
            if(strNoFound == null) 
            	strNoFound = "No devices found";
            mPairedDevicesArrayAdapter.add(strNoFound);
        }
        
        // Indicate scanning in the title
        String strScanning = getIntent().getStringExtra("scanning");
        if(strScanning == null) 
        	strScanning = "Scanning for devices...";
        setProgressBarIndeterminateVisibility(true);
        setTitle(strScanning);

        // Turn on sub-title for new devices
        // findViewById(R.id.title_new_devices).setVisibility(View.VISIBLE);
        // If we're already discovering, stop it
        if (mBtAdapter.isDiscovering()) {
            mBtAdapter.cancelDiscovery();
        }

        // Request discover from BluetoothAdapter
        mBtAdapter.startDiscovery();
    }
private void doDiscovery ( ) { if ( D ) Log . d ( TAG , "doDiscovery()" ) ; mPairedDevicesArrayAdapter . clear ( ) ; if ( pairedDevices . size ( ) > 0 ) { for ( BluetoothDevice device : pairedDevices ) { mPairedDevicesArrayAdapter . add ( device . getName ( ) + "\n" + device . getAddress ( ) ) ; } } else { String strNoFound = getIntent ( ) . getStringExtra ( "no_devices_found" ) ; if ( strNoFound == null ) strNoFound = "No devices found" ; mPairedDevicesArrayAdapter . add ( strNoFound ) ; } String strScanning = getIntent ( ) . getStringExtra ( "scanning" ) ; if ( strScanning == null ) strScanning = "Scanning for devices..." ; setProgressBarIndeterminateVisibility ( true ) ; setTitle ( strScanning ) ; if ( mBtAdapter . isDiscovering ( ) ) { mBtAdapter . cancelDiscovery ( ) ; } mBtAdapter . startDiscovery ( ) ; }
Start device discover with the BluetoothAdapter