title: android View not attached to window manager
body: <p>I am having some of the following exceptions:</p>
  
  <pre><code>java.lang.IllegalArgumentException: View not attached to window manager
  at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:355)
  at android.view.WindowManagerImpl.updateViewLayout(WindowManagerImpl.java:191)
  at android.view.Window$LocalWindowManager.updateViewLayout(Window.java:428)
  at android.app.Dialog.onWindowAttributesChanged(Dialog.java:596)
  at android.view.Window.setDefaultWindowFormat(Window.java:1013)
  at com.android.internal.policy.impl.PhoneWindow.access$700(PhoneWindow.java:86)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.drawableChanged(PhoneWindow.java:1951)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.fitSystemWindows(PhoneWindow.java:1889)
  at android.view.ViewRoot.performTraversals(ViewRoot.java:727)
  at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4338)
  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:860)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>I have googled it and see that it has something to do with popups and turning the screen, but there is no reference to my code.</p>
  
  <p>The questions are:</p>
  
  <ol>
  <li>is there a way to find out
  exactly when this issue is
  happening?</li>
  <li>other than turning the screen, is there another event or action that triggers this error?</li>
  <li>how do I prevent this to happen?</li>
  </ol>