You should do all of your UI (and a progress dialog certainly counts
as UI) in the main thread of your application.


On Fri, Mar 6, 2009 at 12:23 AM, Manfred <manfred.fettin...@gmail.com> wrote:
>
> Hi!
>
> I have a Progress Dialog in an extra Thread running. Normally the user
> will have the keyboard open, because something is to insert! So when
> the Progress Dialog appears and the user close the keyboard, the
> dialog dissappears and the application crashes. In the debugger i saw
> the exception "View not attached to window manager". May because the
> Dialog is not longer shown but the application want to remove it after
> the calculation?
>
> Here is the code where i start the dialog and the thread:
> ------------------------------------------------------------------------------------------
>        alert=0;
>        myProgressDialog = ProgressDialog.show(this,
>                                "Please wait...", "Calculating..", true);
>        new Thread()
>        {
>            public void run()
>            {
>                                try
>                                {
>                                        //Doing some stuff....
>                                }
>                                catch (Exception e)
>                                {
>                                        alert=2;
>                                        alertText = e.getMessage();
>                                }
>
>                                myProgressDialog.dismiss();
>                                mHandler.post(mCompleteRunnable);
>            }
>        }.start();
> ------------------------------------------------------------------------------------------
>
> Does somebody know how to solve this?
>
> Thanks!
> >
>

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

Reply via email to