guys I've been searching and studying about this for a whole day. The app crashes not only when a dialog is open, but also when a spinner is open (and I'm sure it would be bunch of other scenarios that I haven't come across).
choosing between onRetainNonConfigurationInstance() and onConfigurationChanged(Configuration newConfig) won't help me. (maybe I'm wrong) - actually I prefer to use first one.
BUT I want to ask: for a single open dialog box or open spinner do I have to create everything from scratch? is this a way? sometimes it's worthless to reinitialize a big class with lot of widgets inside just for a time that maybe user changes the orientation.
plz give me hints and guidance. Thanks in advance.
Edited :::
Error code:
01-25 17:56:48.182: ERROR/WindowManager(312): Activity XXX has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43e63058 that was originally added here
01-25 17:56:48.182: ERROR/WindowManager(312): android.view.WindowLeaked: Activity XXX has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43e63058 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)
I know that this is from calling dismiss() function. but how can I handle orientation change when having dialog open?