I have an AsyncTask which is implemented as follows:
AsyncTask asyncTask = new AsyncTask() {
@Override
protected Object doInBackground(Object[] params) {
//downloading images from google places api
}
@Override
protected void onPostExecute(Object o) {
}
}
};
asyncTask.execute();
This AsyncTask is triggered to run multiple times and it's executed by the scope of the doInBackground() method of another AsyncTask. It runs fine the first time I load an activity, and if I let all the data download and then exit the activity (so that onStop() is called) and reopen the activity it also runs fine then, but, if I exit the activity before all the data is downloaded it won't run when I reopen the activity.
Does anyone know why this is? Can anyone recommend a better approach that doesn't involve AsynTask?
Note: I have tried using executeOnExecutor() but it hasn't solved the issue.
Thanks in advance