Android SDK v15 running on a 2.3.6 device.
I'm having an issue where onPostExecute()
is still being called when I am calling cancel()
within a doInBackground()
call.
Here is my code:
@Override
public String doInBackground(String... params) {
try {
return someMethod();
} catch (Exception e) {
cancel(true);
}
return null;
}
public String someMethod() throws Exception {
...
}
I am forcing someMethod()
to throw an exception to test this out, and instead of onCancelled being called, I always return to onPostExecute()
. If I check isCancelled()
the returned value is true, so I know that cancel(true)
is being executed.
Any ideas?