title: Android thread main exiting
body: <p>I have thread in "onCreate" which is getting content from web. While the content is getting, I have progress dialog.</p>
  
  <pre><code>new Thread() {
  
       public void run() {
  
       Get_content() ;
  
  
      handler.sendEmptyMessage(0);
       }
  
       }.start();
  </code></pre>
  
  <p>But if I rotate the display (to landscape mode) while this is running, my application gets Force close . In the log I have this:"thread main exiting due to uncaught exception"</p>
  
  <p>Here is my log:</p>
  
  <blockquote>
    <p>W/dalvikvm(17144): threadid=3: thread exiting with uncaught exception (group=0x40013140)
    E/AndroidRuntime(17144): Uncaught handler: thread main exiting due to uncaught exception
    E/AndroidRuntime(17144): java.lang.IllegalArgumentException: View not attached to window manager
    E/AndroidRuntime(17144): at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:356)
    E/AndroidRuntime(17144): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:201)
    E/AndroidRuntime(17144): at android.view.Window$LocalWindowManager.removeView(Window.java:400)
    E/AndroidRuntime(17144): at android.app.Dialog.dismissDialog(Dialog.java:268)
    E/AndroidRuntime(17144): at android.app.Dialog.access$000(Dialog.java:69)
    E/AndroidRuntime(17144): at android.app.Dialog$1.run(Dialog.java:103)
    E/AndroidRuntime(17144): at android.app.Dialog.dismiss(Dialog.java:252)
    E/AndroidRuntime(17144): at com.webservice.KursnaLista$1.handleMessage(KursnaLista.java:77)
    E/AndroidRuntime(17144): at android.os.Handler.dispatchMessage(Handler.java:99)
    E/AndroidRuntime(17144): at android.os.Looper.loop(Looper.java:123)
    E/AndroidRuntime(17144): at android.app.ActivityThread.main(ActivityThread.java:3948)
    E/AndroidRuntime(17144): at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime(17144): at java.lang.reflect.Method.invoke(Method.java:521)
    E/AndroidRuntime(17144): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
    E/AndroidRuntime(17144): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
    E/AndroidRuntime(17144): at dalvik.system.NativeStart.main(Native Method)
    I/dalvikvm(17144): threadid=7: reacting to signal 3
    I/ActivityManager(   59): Process com.webservice (pid 17144) has died.</p>
  </blockquote>