How to pause a thread and execute other code? After the execution is finished, the code behind the thread will continue to execute.

  java, question

The situation is as follows: at present, I need to add a function to an APP, the function has been implemented as an Activity, and now I need to execute code in a thread to a location:

The code here uploads the data to the server and obtains the return result. I want to suspend the execution of the following code (suspend sending) before uploading the data, execute an activity first, and then continue to execute the remaining code in the thread after the execution of that activity is completed.
At present, it is known that Handler and Message are required to execute another activity in the thread. I would like to know how to pause the thread and how to let it continue to execute later.
(Xiao Bai, I hope you have time to help me, thank you very much! ! )

Java, wait and notify