I am working with a init() that need to be synchronise. But I have to run some set of instructions in init() which has to execute on main thread. So I created a runnable to add this instruction. And those instructions has some async calls.
So I am exploring efficient ways to block the init() untill all the instructions completes successfully.
Static void init() {
new Handler(context.getMainLooper()).post(new Runnable() {
@Override
public void run() {
// doing some async calls
}
}
}