title: Android: Enabling bluetooth on call receive
body: <p>I am trying to enable bluetooth upon receiving a call. I have made the code to detect the incoming call by using <code>callstatelistener</code>. However, I am not able to trigger bluetooth activation from the same listener. I tried the following code but it gives me a compilation error as <code>The method startActivityForResult(Intent, int) is undefined for the type CallHelper.CallStateListener</code>. Could any of you please help me out?</p>
  
  <pre><code>final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
  /**
   * Listener to detect incoming calls. 
   */
  
  private class CallStateListener extends PhoneStateListener {
      private static final int REQUEST_ENABLE_BT = 0;
      public boolean wasRinging;
      @Override
      public void onCallStateChanged(int state, String incomingNumber) {
          switch (state) {
          case TelephonyManager.CALL_STATE_RINGING:
              // called when someone is ringing to this phone
  
  
              if (!mBluetoothAdapter.isEnabled()) {
                  Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
                  startActivityForResult(enableBtIntent, 0);
              }
  </code></pre>