How do I open the Bluetooth Settings Activity programmatically?

前端 未结 5 1730
面向向阳花
面向向阳花 2020-12-17 08:26

I want to open bluetooth settings on button click like this see image\"bluetooth

HomeActivity.

5条回答
  •  鱼传尺愫
    2020-12-17 08:51

    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

提交回复
热议问题