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
Use a Listener Listener for that. Example in 2 minutes.
Use an Interface like:
public interface OnTaskCompleted{
void onTaskCompleted(Document doc);
}
Extend your Activity with this Interface:
public YourActivity implements OnTaskCompleted{
//your Activity
}
Let the AsyncTask send an information when it's done.
public YourTask extends AsyncTask
Now you implement the onTaskCompleted in your activity and handle the Document which has been given by the asynctask.