MisterWeary
MisterWeary

Reputation: 605

Basic ASyncTask assistance

Okay, I've read the Android documentation and been perusing article after article on ASyncTask and just don't understand how to get information back from my external ASyncTask class. This runs fine:

    myASyncTask = new MyASyncTask();
    myASyncTask.execute(myParam);

...and I fully expect the task to complete but how do I get anything back from it? The documentation says that onPostExecute is invoked on the UI thread but it also says to not call onPostExecute manually?!? How do I get data back from my ASyncTask object???

I've got it to work fine when I create my ASyncTask as an inner class but I'd rather this task be external so I can call it from different Activitys.

Upvotes: 1

Views: 142

Answers (1)

user1583703
user1583703

Reputation:

If you read the documentation you can use get method to get the result , and it waits till the task is done .

You can also use getStatus to get the current status of the task , assuming it publishes it .

Upvotes: 1

Related Questions