1
在我的應用程序中,我使用DialogFragment顯示幾秒鐘的對話框,現在當我更改設備的屏幕方向時,應用程序崩潰,因爲我在對話框片段中使用的上下文變爲空。 搜索後,我發現在我的活動onDestroy()方法我應該消除該對話框,如果它已經顯示,以便我的應用程序不會崩潰。 現在我需要得到那個對話框,展示我如何得到它?這樣我可以在其上實現 檢查任何建議將理解如何獲得使用DialogFragment附加的對話框? [ANDROID]
https://開頭計算器。 com/questions/3329318/android-how-to-not-destroy-the-activity-when-i-rotate-the-device –
你可以通過覆蓋'onConfigurationChanged'來處理它https://developer.android.com/guide /topics/resources/runtime-changes.html#HandlingTheChange。這將避免活動再次重新啓動,因此上下文不會變爲空。 –
@vikashkumarpandey多數民衆贊成它的工作鏈接 – User