我使用了以下代码来启用蓝牙 ( as described here ) 并且在我的应用程序启动器 Activity 的 onCreate() 中运行了相同的代码 -
Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableIntent, 101);
现在的问题是当弹出这个对话框时,每次我旋转设备时,都会在之前创建的对话框之上再次创建该对话框。
我通过从 list 中处理它来防止重新创建我的 Activity
android:configChanges="orientation|screenSize|keyboardHidden"
这不会发生在所有设备上 我正在接受这个: LG Nexus 5、三星 Galaxy Grand
而不是: 三星 I9500 盖乐世 S4
编辑: 找到此报告的问题但找不到解决方案 Here is the link
创建了另一个问题 Here
最佳答案
看来这个错误一直没有解决!!
我已经在包括最新的 Pixel device 在内的多个设备上对此进行了测试它仍然存在
在 code.google.com/p/android 上多次提出同样的问题
引用提出的问题:
Issue 60002: Bluetooth permission request dialog
Issue 219105 On each rotation, dialog for requesting user permission to enable Bluetooth, the request dialog is placed on the top of the stack
Issue 24931: Bluetooth permission request dialog - recreated on screen rotation(orientation change)
如果有人找到解决方案,请在此处发布
关于android - 蓝牙权限请求对话框 - 在屏幕旋转时重新创建(方向更改),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38739407/