I am having trouble understanding how to use the logic Looper prepare()/ loop()/ quit().
I have three streams: one is the user interface stream, one is the game logical stream, and the last is the network communication stream (background stream, lives only when used).
The game stream has many dependencies on the results of network calls, so I wanted to turn off the network stream from the game stream and return the Handlerresult.
Of course, since the UI thread is not involved, I need to call Looper.prepare()... somewhere. I thought that it should be called in the game stream, but I can not do this because it loop()takes it.
How can I go back to the game stream from the network stream using my handler?
source
share