傢伙我一直在搜索和研究這一整天。該應用程序不僅在打開對話框時崩潰,而且在微調控件打開時也會崩潰(並且我確信它會是其他一些我沒有遇到的場景)。當警報對話框打開並且手機(模擬器)改變方向時,應用程序崩潰
onRetainNonConfigurationInstance()和onConfigurationChanged(Configuration newConfig)之間的選擇不會幫助我。 (也許我錯了) - 實際上我更喜歡使用第一個。
但是我想問:單個打開的對話框或打開微調框,我必須從頭開始創建一切嗎?這是一種方式嗎?有時候在用戶改變方向的時候重新初始化一個擁有大量小部件的大類是沒有價值的。
PLZ給我提示和指導。 在此先感謝。
編輯:::
Error code:
01-25 17:56:48.182: ERROR/WindowManager(312): Activity XXX has leaked window [email protected] that was originally added here
01-25 17:56:48.182: ERROR/WindowManager(312): android.view.WindowLeaked: Activity XXX has leaked window [email protected] that
was originally added here
01-25 17:56:48.182: ERROR/WindowManager(312): at android.view.ViewRoot.<init>(ViewRoot.java:247)
01-25 17:56:48.182: ERROR/WindowManager(312): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
01-25 17:56:48.182: ERROR/WindowManager(312): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
01-25 17:56:48.182: ERROR/WindowManager(312): at android.view.Window$LocalWindowManager.addView(Window.java:424)
01-25 17:56:48.182: ERROR/WindowManager(312): at android.app.Dialog.show(Dialog.java:241)
01-25 17:56:48.182: ERROR/WindowManager(312): at XXX.menuGroupDialog(XXX.java:946)
0 1-25 17:56:48.182: ERROR/WindowManager(312): at XXX.onOptionsItemSelected
(GroupManagement.java:257)
01-25 17:56:48.182: ERROR/WindowManager(312): at android.app.Activity.onMenuItemSelected(Activity.java:2195)01-25 17:56:48.182: ERROR/WindowManager(312): at
com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730)
01-25 17:56:48.182: ERROR/WindowManager(312): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143)
01-25 17:56:48.182: ERROR/WindowManager(312): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
01-25 17:56:48.182:
ERROR/WindowManager(312): at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532)
01-25 17:56:48.182: ERROR/WindowManager(312): at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
01-25 17:56:48.182: ERROR/WindowManager(312): at android.view.View$PerformClick.run(View.java:8816)
01-25 17:56:48.182: ERROR/WindowManager(312): at
android.os.Handler.handleCallback(Handler.java:587)
01-25 17:56:48.182: ERROR/WindowManager(312): at android.os.Handler.dispatchMessage(Handler.java:92)
01-25 17:56:48.182: ERROR/WindowManager(312): at android.os.Looper.loop(Looper.java:123)
01-25 17:56:48.182: ERROR/WindowManager(312): at
android.app.ActivityThread.main(ActivityThread.java:4627)
01-25 17:56:48.182: ERROR/WindowManager(312): at java.lang.reflect.Method.invokeNative(Native Method)
01-25 17:56:48.182: ERROR/WindowManager(312): at java.lang.reflect.Method.invoke(Method.java:521)
01-25 17:56:48.182: ERROR/WindowManager(312): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-25 17:56:48.182: ERROR/WindowManager(312): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-25 17:56:48.182: ERROR/WindowManager(312): at
dalvik.system.NativeStart.main(Native Method)
我知道,這是從調用解僱()函數。但是如何在對話框打開時處理方向改變?
郵政錯誤消息請 – WarrenFaith 2011-01-26 01:17:30
代碼,請!!!!! – the100rabh 2011-01-26 01:49:16