且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

安卓:试图启动BluetoothSettings活动强制关闭并抛出NullPointerException异常

更新时间:2023-11-19 12:21:46

这code对我的作品

    Intent intentBluetooth = new Intent();
    intentBluetooth.setAction(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS);
    startActivity(intentBluetooth);     

您需要测试它在手机上,otherways您将获得在模拟器上奇怪的错误(不支持蓝牙)。

You need to test it on the phone, otherways you will get strange errors on the emulator (Bluetooth not supported).