title: Detecting state changes made to the BluetoothAdapter?
body: <p>I have an app with a button on it that I use to turn BT on and off. I have the following code in there;</p>
  
  <pre><code>public void buttonFlip(View view) {
      flipBT();
      buttonText(view);
  }
  
  public void buttonText(View view) {  
      Button buttonText = (Button) findViewById(R.id.button1);
      if (mBluetoothAdapter.isEnabled() || (mBluetoothAdapter.a)) {
          buttonText.setText(R.string.bluetooth_on);  
      } else {
          buttonText.setText(R.string.bluetooth_off);
      }
  }
  
  private void flipBT() {
      if (mBluetoothAdapter.isEnabled()) {
          mBluetoothAdapter.disable();    
      } else {
          mBluetoothAdapter.enable();
      }
  }
  </code></pre>
  
  <p>I'm calling button Flip, which flips the BT state, and then calls ButtonText, which should update the UI. However, the issue I'm having is, it takes a few seconds for BT to turn on - and during these seconds, the BT status is not enabled, making my button say Bluetooth off, even if it will be on in 2 seconds.</p>
  
  <p>I found the <code>STATE_CONNECTING</code> constant in the BluetoothAdapter android documentation, but... I simply don't know how to use it, being a newbie and all.</p>
  
  <p>So, I've got two questions:</p>
  
  <ol>
  <li>Is there a way to dynamically tie a UI element (such as a button or image) to a BT state, so that when the BT state changes, the button will change as well?</li>
  <li>Otherwise, I would want to press the button and get the correct state (I would like for it to say BT on, even if it's only connecting, since it will be on in 2 seconds). How do I do this?</li>
  </ol>