In my application I have an AsyncTask and I've also created a list, to add task to that list. In the AsyncTask I am downloading some information, and it works just fine, but, when close activity using finish(), I often get Force Close because the AsyncTask wasn't closed and when it reaches to onPostExecute and wants to interact with UI, it crashes caused activity has been destroyed!
this is what I've tried but didn't work:
for (int i = 0; i<tasks.size(); i++){
tasks.get(i).cancel(true);
}
finish();
so is there way force stop AsyncTasks ?
0 comments:
Post a Comment