How to get asyn result? (Do not block the ui thread)


I need to do this get result

Future<?> future = executor.submit(callable);
return (String) future.get();

Previously, the results were obtained asynchronously without blocking the UI thread

But now I need to get the results first, and then proceed to the next step. How do I do it?


Comment actions Permalink

Please provide a more complete code sample. It's impossible to guess what happens here,e.g. where does executor instance come from etc.

Comment actions Permalink


Callable is a time-consuming operation that waits for the results to be obtained after the operation is completed.

Now is the

(String) future.get();

the UI thread will be blocked. What do I do?


Please sign in to leave a comment.