title: How to disable the Bluetooth in android?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3806536/how-to-enable-disable-bluetooth-programmatically-in-android">How to enable/disable bluetooth programmatically in android</a>  </p>
  </blockquote>
  
  
  
  <p>I'm a newbie in android development. I'm not able to disable Bluetooth in my app. Here I've used a checkbox.Enabling of which enables the bluetooth but while disabling it remains enable.. What do I do?</p>
  
  <p>My code:</p>
  
  <pre><code>enable_chkbox=(CheckBox)findViewById(R.id.chkboxenable);
  enable_chkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
  
      @Override
      public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
          // TODO Auto-generated method stub
          if(buttonView.isChecked())
          {
              if (!mBluetoothAdapter.isEnabled()) {
                  Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
                  startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
              }
              else if(!buttonView.isChecked())//updated
              {
                  mBluetoothAdapter.disable();
              //finish();
              }
          }
      }
  });
  </code></pre>
  
  <p>Android Manifest file permissions:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.BLUETOOTH" /&gt;
  &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/&gt;
  </code></pre>