1

我用下面的代碼實現藍牙(as described here)重新對屏幕旋轉(方向更改),並在的onCreate()我的應用程序的發射活動的同時運行 -藍牙權限請求對話框 -

Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); 
startActivityForResult(enableIntent, 101); 

現在問題出現在這個對話框彈出的時候,每當我旋轉設備時,對話框都會在之前創建的對話框上重新創建。

我阻止我的活動從得到重建從清單

android:configChanges="orientation|screenSize|keyboardHidden" 

處理呢?這不會發生在所有的設備 我收到此有關: LG的Nexus 5,三星Galaxy大

而不是: 三星I9500的Galaxy S4

編輯: 發現這個報告的問題,但無法找到解決 Here is the link

創造了另一個問題Here

回答

1

看來這個錯誤是永遠不會得到解決!
我曾在多個設備上,包括最新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)


如果有人發現解決方案那麼請張貼在這裏

0

當我們轉動裝置,其CONFIGRATION變化的方法是在活動的呼叫。 你只需要添加android:configChanges="orientation"在您的活動元素AndroidManifest.xml

<activity 
      android:name=".MainActivty" 
      android:configChanges="orientation" 
      android:label="@string/app_name"></activity> 

我希望它會幫助你解決問題

+1

我已經處理了「onConfigurationChanged」中的配置更改。所以我認爲這不會有幫助! – shadygoneinsane

+0

一次又一次創建的對話框位於onResume()函數或任何其他函數中 –

+1

由於我的活動未獲得重新創建,因此保存用於創建對話框的代碼的onResume()或onCreate()不會再次在設備上調用迴轉.. – shadygoneinsane