06-15 15:49:11.467: ERROR/AndroidRuntime(271):
*android.util.AndroidRuntimeException: { what=6 when=56421 } This message is
already in use.*
06-15 15:49:11.467: ERROR/AndroidRuntime(271):     at
android.os.MessageQueue.enqueueMessage(MessageQueue.java:171)

*               message1 = Message.obtain();*

                do{
                        SystemClock.sleep(sleep_time);
*                        handler1.sendMessage(message1);*

                } while (!Thread.currentThread().isInterrupted());


Get a fresh message with obtain() every time you need one for sendMessage.

And I doubt you really need a Thread / Runnable / sleep() just to schedule
periodic tasks. Take a look at Handler.sendMessageDelayed.

-- Kostya

2011/6/15 andorid.italia <[email protected]>

> Hi to all.
> I've the following problem.I have an activity with two togglebutton :
> the first lets start a new thread that send messages to the main
> thread who care about them trought handlemessage(), and call thhe
> invalidate.
> The problem is that when I click on this firrst togglebutton, the
> animation starts, but when I re-click on it, I have the folloqing
> messaege on Logcat. Does anybody want to help me ??? THANKS
>
> LOGCAT ERROR when i Click on the toggle button and then reclick on
> it :
>
> 06-15 15:49:11.067: DEBUG/onClick(271): Sono in onClick
> 06-15 15:49:11.067: DEBUG/onClick(271): pulsante OFF premuto
> 06-15 15:49:11.457: WARN/dalvikvm(271): threadid=7: thread exiting
> with uncaught exception (group=0x4001d800)
> 06-15 15:49:11.467: ERROR/AndroidRuntime(271): FATAL EXCEPTION:
> Thread-8
> 06-15 15:49:11.467: ERROR/AndroidRuntime(271):
> android.util.AndroidRuntimeException: { what=6 when=56421 } This
> message is already in use.
> 06-15 15:49:11.467: ERROR/AndroidRuntime(271):     at
> android.os.MessageQueue.enqueueMessage(MessageQueue.java:171)
> 06-15 15:49:11.467: ERROR/AndroidRuntime(271):     at
> android.os.Handler.sendMessageAtTime(Handler.java:457)
> 06-15 15:49:11.467: ERROR/AndroidRuntime(271):     at
> android.os.Handler.sendMessageDelayed(Handler.java:430)
> 06-15 15:49:11.467: ERROR/AndroidRuntime(271):     at
> android.os.Handler.sendMessage(Handler.java:367)
>

-- 
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