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

Answered

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?

 

3 comments
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.

0
Comment actions Permalink

Hello,

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?

0

Please sign in to leave a comment.