Running code in main thread from another thread

In an android service I have created thread(s) for doing some background task.

I have a situation where a thread needs to post certain task on main thread’s message queue, for example a Runnable.

Is there a way to get Handler of the main thread and post Message/Runnable to it from my other thread?

17 Answers
17

Leave a Comment