I keep getting this crash report from my users:

java.lang.IllegalArgumentException: View not attached to window manager
        at 
android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:355)
        at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:200)
        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:123)
        at android.app.ActivityThread.main(ActivityThread.java:4627)
        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:858)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
        at dalvik.system.NativeStart.main(Native Method)


I don't know if it's any one particular Activity causing the issue,
none of my code appear in the stack trace..  but my typical pattern
looks like this:


private void getCurrentGames()
  {
    if( this != null )
    {
      progressDialog = ProgressDialog.show( this, "Working . . .",
"Getting current games.." );
    }

    new Thread()
    {
      @Override
      public void run()
      {
        getCurrentGames();
        handler.post( updateCurrentGames );

        if( this != null && progressDialog != null )
        {
          try
          {
            progressDialog.dismiss();
          }
          catch( Exception e )
          {
          }
        }
      }
    }.start();
  }

How can I keep my dismiss() calls from blowing up?  Why doesn't try/catch work?


-- 
Greg Donald

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to