I'd like to send messages to the main UI thread every second.

This is what I did.

When I need to start to send messages - I create a Thread
from the Activity instance. this is what the thread run() method looks like:

        public void run()
        {
            try
            {
                while ( !this.isInterrupted() )
                {
                    android.os.Message msg = android.os.Message.obtain( 
simHandler, 0, simulator );

                    simHandler.sendMessage(msg);
                
                    this.sleep( 1000 );
                }
            }
            catch ( Exception e )
            {
            }
        }


then i send a message to a handler - because I want to do the
work in the UI thread.

right way?



-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to