On Sat, Apr 24, 2010 at 11:18 AM, Anurag Singh <[email protected]>wrote:

>  1. use global varibales
>
Not without appropriate locking or other synchronization.

> 2. use named pipe streams
>
> 3. use socket
>
> 4. use file system
>
Don't do these things for threads running in the same process (which is what
the original poster is asking about); much more overhead and complexity for
no purpose.

Handler is Android's standard way to get stuff back on the main thread.
 Create one in the main thread, then post messages or (Runnable objects if
desired) to get what you want to that thread.

The other Java concurrency stuff can be useful, but be careful because you
don't want to end up with your main thread using that and blocking on one of
the other threads for data from it.  The main thread is message-based, so
posting messages to it via Handler is a good approach.

-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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