title: How do I open the Bluetooth Settings Activity programmatically?
body: <p>I want to open bluetooth settings on button click 
  like this see image<img src="https://i.stack.imgur.com/PHlob.png" alt="bluetooth image"></p>
  
  <p><strong>HomeActivity.java</strong></p>
  
  <pre><code>button.setOnClickListener(new OnClickListener() {
  
              public void onClick(View v) {
                  final Intent intent = new Intent(Intent.ACTION_MAIN, null);
                  intent.addCategory(Intent.CATEGORY_LAUNCHER);
                  final ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.bluetoothSettings");
                  intent.setComponent(cn);
                  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                  startActivity( intent);
              }
          });
  </code></pre>