I know Android UI is not really meant for executing functions and waiting for them to finish, however, I think there are use cases were it is required, like networking.

My problem is, I want to run a series of network operations that rely on each other and take a bit more time than the split second it takes to the next execution, so some waiting is in order:

1. Start hotspot
2. Get network interfaces and IP
3. Start socket

Initially I tested that all is working using buttons, then it waited between my button presses. But now I'd like to automatize it. I googled but all I found are solutions with Async task, which is deprecated. I tried with threads and join, but that usually causes weird crashes in the runnable, and it is not very elegant. I wonder if there is another solution?