问题
I wonder if it has any meaning to call super.onPostExecute(result) or super.onPreExecute in Android AsyncTask? I have been always calling them, but even in Android documentation about AsyncTask (Android API Reference: AsyncTask) they are omitted. So does it make any sense if I call them or not?
回答1:
No, there is no need to call the superclass. If you take a look at the AsyncTask
source, you will see that the super class does nothing:
@SuppressWarnings({"UnusedDeclaration"})
protected void onPostExecute(Result result) {
}
回答2:
It has no effect if you call them or not, becase both have empty implementation in AsyncTask
and they are there only to allow you override them, but does not force you to do that.
来源:https://stackoverflow.com/questions/20637355/should-i-call-super-onpostexecuteresult-in-android-asynctask