I’m curious about the get(long, java.util.concurrent.TimeUnit) function in AsyncTask, but I’m having a hard time locating an example of it’s usage.
get(long, java.util.concurrent.TimeUnit)
Can anyone provide an example of it’s use?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It appears as though
AsyncTask.get()blocks the caller thread, whereAsyncTask.execute()does not.You might want to use
AsyncTask.get()for test cases where you want to test a particular Web Service call, but you do not need it to be asynchronous and you would like to control how long it takes to complete. Or any time you would like to test against your web service in a test suite.Syntax is the same as execute: