cppdev
cppdev

Reputation: 6973

Android Message Queue Per Thread or Per Handler

I am writing my handlers in two different activities which are running on the same UI thread. Now the question is if I post a message using these two different handlers, would it end up in the same message queue associated with the main thread or each handler has a separate message queue associated with it.

Any pointers will be appreciated.

Upvotes: 0

Views: 1212

Answers (2)

Dheeraj Vepakomma
Dheeraj Vepakomma

Reputation: 28697

Each Handler is associated with a Looper. A Looper is in turn associated with a Thread.

So if you have a single thread, you'll have a single message queue.

Check this link for a nice introduction to Loopers & Handlers.

Upvotes: 1

Volodymyr Lykhonis
Volodymyr Lykhonis

Reputation: 2976

You should look at this Handler

Upvotes: 1

Related Questions