How do I open the Bluetooth Settings Activity programmatically?
android, android-intent, settings
Solution
use
ComponentName cn = new ComponentName("com.android.settings",
"com.android.settings.bluetooth.BluetoothSettings");
instead of
final ComponentName cn = new ComponentName("com.android.settings",
"com.android.settings.bluetoothSettings");
to launch BluetoothSettings settings
Problem
I want to open bluetooth settings on button click like this see image HomeActivity.java ``` 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); } }); ```