All,

I think that find a solution for your problem!

          try{

                         //do code

                }
              finally
                {
                    msg.what = 1001;
                    this.HandlerListaPaciente.sendMessage(msg);
                }


    Handler HandlerListaPaciente = new Handler(){
                public void handleMessage(Message arg0) {
         if(msg.what==1000)
                showAlert("Attention", Color.CYAN,"Patient not found!", "Ok",
true);
         else if(msg.what==1001)
                     progresso.dismiss();

                    super.sendMessage(arg0);
        }
        };


On 3 abr, 16:14, thrusty <[EMAIL PROTECTED]> wrote:
> As a workaround, is there a good way to detect whether your activity's
> window is displayed on screen?
>
> The following seems to help somewhat, but isn't bulletproof:
>
>         if (( getWindow().isActive()) && (null != peekDecorView())) {
>                 this.runOnUIThread(this.mProgressUpdateRunnable);
>         }
>
> On Feb 18, 12:47 am, "Romain Guy" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
> > runOnUIThread() works only after your activity's window is displayed on
> > screen. I'll take a look to see if I can improve that.
>
> > On Feb 18, 2008 2:44 AM, baker <[EMAIL PROTECTED]> wrote:
>
> > > Romain,
>
> > > I'm seeing the following error after substituting calls from
> > > myHandle.post() to runOnUIThread()
>
> > > ERROR/AndroidRuntime(702): java.lang.IllegalArgumentException: View
> > > [EMAIL PROTECTED] must be attached to a
> > > window
> > > ERROR/AndroidRuntime(702):     at
> > > android.view.UIThreadUtilities.isUIThread(UIThreadUtilities.java:45)
> > > ERROR/AndroidRuntime(702):     at
> > > android.view.UIThreadUtilities.runOnUIThread(UIThreadUtilities.java:
> > > 64)
> > > ERROR/AndroidRuntime(702):     at
> > > android.view.UIThreadUtilities.runOnUIThread(UIThreadUtilities.java:
> > > 85)
> > > ERROR/AndroidRuntime(702):     at
> > > android.app.Activity.runOnUIThread(Activity.java:2575)
> > > ERROR/AndroidRuntime(702):     at
> > > com.elimatta.bullroarer.activity.ChannelDiscovery
> > > $FindChannelsRunnable.startProgressIndicator(ChannelDiscovery.java:
> > > 433)
> > > ERROR/AndroidRuntime(702):     at
> > > com.elimatta.bullroarer.activity.ChannelDiscovery
> > > $FindChannelsRunnable.run(ChannelDiscovery.java:409)
> > > ERROR/AndroidRuntime(702):     at java.lang.Thread.run(Thread.java:
> > > 896)
>
> > > This is the code that is been executed in the Runnable
>
> > >                private void startProgressIndicator()
> > >                {
> > >                        // perform pre parent window tasks
> > >                        runOnUIThread(new Runnable() {
> > >                                public void run() {
> > >                                    // start progress indicator
> > >                                        final Window window = getWindow();
> > >                                        window.setFeatureInt(
> > > Window.FEATURE_PROGRESS,
> > > Window.PROGRESS_VISIBILITY_ON);
> > >                                        window.setFeatureInt(
> > > Window.FEATURE_PROGRESS,
> > > Window.PROGRESS_INDETERMINATE_ON);
> > >                                }
> > >                        });
> > >                }
>
> > > and my class extends a MapActivity
>
> > > It's not a big deal, I can work around it by using a Handle instance,
> > > just interested to find out if I'm doing something wrong or maybe this
> > > is a possible bug.
>
> > > Thanks,
>
> > > Craig.
>
> > > On Feb 18, 3:42 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> > > > You don't have to start your own looper. You just need to create a
> > > Handler
> > > > and override the handleMessage() method if you want to work with
> > > messages:
> > >http://code.google.com/android/reference/android/os/Handler.html#hand...)
>
> > > > And if all you need is a Runnable, just call View.post(Runnable), do not
> > > > even create your own Handler.
>
> > > > On Feb 17, 2008 8:39 PM, Gavin Bong <[EMAIL PROTECTED]> wrote:
>
> > > > > I went ahead and added a custom Handler inside my view.
> > > > > I made my view implements Runnable and started a Looper.
> > > > > Question: I don't see any lifecycle methods to hook into if the view
> > > > > is disposed.
>
> > > > > Where should I shutdown the looper thread ?
>
> > > > > Thanks
>
> > > > > Gavin
>
> > > > --
> > > > Romain Guywww.curious-creature.org
>
> > --
> > Romain Guywww.curious-creature.org- Ocultar texto entre aspas -
>
> - Mostrar texto entre aspas -
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to