Back to project page Common-Library.
The source code is released under:
Apache License
If you think the Android project Common-Library listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.morgan.library.async; //from www.j av a 2s . c o m import android.os.AsyncTask; /** * ??????{@link AsyncTask}????{@link Destroyable}???????????? * {@link #onPostExecute(Object)} ?????????super.onPostExecute(result)? * * @author Morgan.Ji */ public abstract class CustomAsyncTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> implements Destroyable { private IFeedback mFeedback; private boolean mDestoried = false; public CustomAsyncTask(IFeedback feedback) { this.mFeedback = feedback; } @Override public void onDestory() { if (cancelable() && !isCancelled()) { cancel(true); } else { mDestoried = true; } } @Override protected void onPostExecute(Result result) { super.onPostExecute(result); if (!mDestoried) { mFeedback.onFeedback(getKey(), isSuccess(), result); } } public abstract String getKey(); public abstract boolean isSuccess(); }