This was probably asked earlier, but there did not seem to be a viable answer. We use the Retrofit 2.1.0 asynchronous callback, which executes the request in the background thread. However, when the response is received by onResponse , it is sent back to the application user interface thread, regardless of the fact that I put the callback in the new thread, causing it not to use the user interface.
Since we donβt want to block the main UI thread for any reason, is it possible for the response to return in the background?
If this is not possible above, is it recommended to disconnect a separate thread from the response in order to avoid blocking user interface threads?
Any help would be greatly appreciated. Thanks!
java android multithreading retrofit2
Zishan
source share