W
W
Who_Is_Who2018-10-23 12:21:54
Java
Who_Is_Who, 2018-10-23 12:21:54

First, the method in the reference is executed, and then after the return, the execution of the main code continues?

How to implement first the execution of the method in the link, and then after the return (execution of the method) continue the execution of the main code?
In the called method, I need to get an int variable, then I get it in the main class through the Setter, and then I use this variable in the code in the main class method, from where I launched the method of another class.
Now the method is apparently executed in the background while the main code continues to run. Therefore, I get the default value of the variable.
In first grade:

Метод:
Второй_класс num = new Второй_класс();
num.dowload_Num();

Продолжение кода, связанного с результатом метода dowload_Num()

Maybe it's worth creating a Thread, maybe there is something simpler? Tried onPause(), didn't help.
I would like to do without sleep, since the execution time of the method for the user is unknown

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2018-10-23
@Who_Is_Who

There is no way to do this in Java. Use callbacks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question