Ejemplo n.º 1
0
  /** Handles a request to start the Loader. */
  @Override
  protected void onStartLoading() {
    if (this.data != null) {
      // If we currently have a result available, deliver it
      // immediately.
      deliverResult(this.data);
    }

    // Start watching for changes in the app data.
    if (pathObserver == null) {
      pathObserver = new PathObserver(this, dir.getAbsolutePath());
      pathObserver.startWatching();
    }
    if (null == this.data || takeContentChanged()) {
      forceLoad();
    }
  }
Ejemplo n.º 2
0
  /** Handles a request to completely reset the Loader. */
  @Override
  protected void onReset() {
    super.onReset();

    // Ensure the loader is stopped
    onStopLoading();

    // At this point we can release the resources associated with 'apps'
    // if needed.
    if (this.data != null) {
      onReleaseResources(this.data);
      this.data = null;
    }

    // The Loader is being reset, so we should stop monitoring for changes.
    if (pathObserver != null) {
      pathObserver.stopWatching();
      pathObserver = null;
    }
  }