Code example for FragmentActivity

Methods: getApplicationContext, startActivityForResult

0
	void findBT() 
    { 
        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        if(mBluetoothAdapter == null)
        { 
        	Toast.makeText(getApplicationContext(), "No bluetooth adapter available", Toast.LENGTH_LONG).show();
           // myLabel.setText("No bluetooth adapter available"); 
        } 
         
        if(!mBluetoothAdapter.isEnabled())
        { 
            Intent enableBluetooth = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
            startActivityForResult(enableBluetooth, 0);
        } 
         
        Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
        mmDevice = mBluetoothAdapter.getRemoteDevice(address);
        if (pairedDevices.contains(mmDevice))
        { 
        //statusText.setText("Bluetooth Device Found, address: " + mmDevice.getAddress() ); 
        Log.d("ArduinoBT", "BT is paired");
        } 
        Toast.makeText(getApplicationContext(), "Bluetooth Device Found", Toast.LENGTH_LONG).show();
        //myLabel.setText("Bluetooth Device Found"); 
    } 
     
    void openBT() throws IOException 
    {