I want to return the document to my main class but even using a global variable dosen\'t work it\'s because the asynctask didn\'t finish the job I think is there a solution to g
OnPostExecute is where you receive the Document when it finishes downloading in the main thread, that is the place where you want to return tour item.
It occurs to me that you can implement a constructor in the asynctask, something like
private class RequestTask extends AsyncTask {
private MainClass myClass
public RequestTask(MainClass myClass){
this.myClass = myClass
}
...
protected void onPostExecute(Document doc) {
super.onPostExecute(doc);
myClass.myMethod(doc);
}
...
}
That way you can receive the Document in your main Class
Hope it helps
Greetings