Code example for AsyncTaskLoader

Methods: cancelLoad, onReset

0
 
    @Override 
    public boolean cancelLoad() { 
        mElements = null;
 
        return super.cancelLoad(); 
    } 
 
    @Override 
    protected void onStartLoading() { 
        if(mElements != null) {
            deliverResult(mElements);
            return; 
        } 
        mCancel = false;
        forceLoad();
 
    } 
 
    @Override 
    protected void onReset() { 
        super.onReset(); 
        cancelLoad(); 
    } 
 
    @Override 
    public void deliverResult(ArrayList<Car> data) {