title: Android Bluetooth enable error
body: <p>I am developing an android application with bluetooth functionality. But i have got one problem. I am using following code</p>
  
  <pre><code> BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
  
     if (mBluetoothAdapter == null) {
  
    // Device does not support Bluetooth
  
      tv.setText("Device is not there");
  
     setContentView(tv);
  
     }
     else
     {
         if (!mBluetoothAdapter.isEnabled()) {
              Intent enableBtIntent = new    Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
              startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
          }
     tv.setText("Device is there");
     setContentView(tv);
     }
  </code></pre>
  
  <p>I am getting error at </p>
  
  <pre><code> if (!mBluetoothAdapter.isEnabled()) {
  
   Intent enableBtIntent = new    Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
  
   startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
          }
  </code></pre>
  
  <p>whenever i try to run that code, my application crashes by showing a message box with "Force close" button. Where is the error, i am not figuring it out yet. Kindly help.
  Regards</p>