Code example for AsyncTaskLoader

0
public abstract class GenericAsyncTaskLoader<T> extends AsyncTaskLoader<T> {
 
    private T mData;
 
    public GenericAsyncTaskLoader(Context context) {
        super(context);
    } 
 
    /** 
     * Called when there is new data to deliver to the client. The super class 
     * will take care of delivering it; the implementation here just adds a 
     * little more logic. 
     */ 
    @Override 
    public void deliverResult(T data) {
        if (isReset()) {
            // An async query came in while the loader is stopped. We 
            // don't need the result. 
            if (data != null) {
                onReleaseResources(data);