try {
task.get(1000, TimeUnit.MILLISECONDS);
} } catch (ExecutionException e) {
e.printStackTrace();
} } catch (InterruptedException e) {
e.printStackTrace();
} } catch (TimeoutException e) {
e.printStackTrace();
}
I wonder what this code means. in the async task I think it goes in after executing the task, can I know the meaning?
android java android-asynctask
If you raise the sauce like this, I can't tell exactly what type task
is, so please fill it out so that you can see the package.
I think it's android.os.AsyncTask#get(long timeout, TimeUnit)
in context.
task.get(1000, TimeUnit.MILLISECONDS);
Here, get
means to return the execution result of task
, but if necessary, wait until task
is finished. If it does not exit after 1000 milliseconds, the TimeoutException
exception occurs.
© 2024 OneMinuteCode. All rights reserved.