Just create an AsyncTask
with no onPostExecute
method overridden
public class YourTask extends AsyncTask<Whatever, Whatever, Whatever> {
@Override
protected Whatever doInBackground(Whatever... whatever) {
// whatever
return whatever;
}
}
And then when you want different implementations of onPostExecute
, create anonymous task or descendant class and use it
task = new YourTask() {
@Override
protected void onPostExcecute(Whatever result) {
//whatever
}
};
task.execute();
Or better
public class YourTaskAnother extends YourTask {
// just override onPostExecute here
@Override
protected void onPostExcecute(Whatever result) {
//whatever
}
}
task = new YourTaskAnother();
task.execute();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…