0

It seems like my application crashes after it is not used for a long time... To reproduce: do not use the application for one day. Then try to start again.

I guess it happens when application is in Stop mode, but can't be sure. My question is - how do I debug this? Also - how can I prevent this?

And I believe this is what causes it:

java.lang.IllegalArgumentException: View not attached to window manager
at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:391)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:236)
at android.view.Window$LocalWindowManager.removeView(Window.java:432)
at android.app.Dialog.dismissDialog(Dialog.java:278)
at android.app.Dialog.access$000(Dialog.java:71)
at android.app.Dialog$1.run(Dialog.java:111)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:5061)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Kara
  • 6,115
  • 16
  • 50
  • 57
OkyDokyman
  • 3,786
  • 7
  • 38
  • 50
  • Would you mind changing your window orientation and seeing if that has anything tod o with the crash? – JSWork Apr 04 '11 at 14:00
  • Do you have and progress dialogs that are getting dismissed? – cutts Apr 04 '11 at 14:03
  • I do not have progress dialog on first screen. Also the first screen has: setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); – OkyDokyman Apr 04 '11 at 14:22

1 Answers1

1

Here is one possible solution: How to handle screen orientation change when progress dialog and background thread active?

When you switch orientations, Android will create a new View. You're probably getting crashes because your background thread is trying to change the state on the old one. (It may also be having trouble because your background thread isn't on the UI thread)

tl;dr: you have to update your screen handler when the device orientation changes.

Community
  • 1
  • 1