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
public void mainWork() { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { //Add Your Code Here } }); }
This can also work in a service class with no issue.