Whether the challenge to forceLoad and deliverResult in AsyncTaskLoader



  • I have AsyncTaskLoader in which only the designer and the method are implemented doInBackground♪ On call:

    mLoadData = getSupportLoaderManager().initLoader(LOADER_ID, bundle, this);
    mLoadData.onContentChanged();
    

    It's just a designer! But if I add:

    @Override
        public void forceLoad() {
            Log.i(TAG, MSG + "forceLoad");
            super.forceLoad();
        }
    
    @Override
    protected void onStartLoading() {
        super.onStartLoading();
        Log.i(TAG, MSG + "onStartLoading");
        forceLoad();
    }
    
    @Override
    protected void onStopLoading() {
        super.onStopLoading();
        Log.i(TAG, MSG + "onStopLoading");
    }
    
    @Override
    public void deliverResult(ArrayList<ArrayList<ArrayList<String>>> list) {
        Log.i(TAG, MSG + "deliverResult");
        super.deliverResult(list);
    }
    

    Everything starts working. loadInBAckground! Are they binding?



  • No change of methods is required. We just need to forget. forceLoad After the initialization of the loader.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2