/** * Handles a request to start the Loader. */ protected override void OnStartLoading() { if (mApps != null) { // If we currently have a result available, deliver it // immediately. DeliverResult(mApps); } // Start watching for changes in the app data. if (mPackageObserver == null) { mPackageObserver = new PackageIntentReceiver(this); } // Has something interesting in the configuration changed since we // last built the app list? bool configChange = mLastConfig.ApplyNewConfig(Context.Resources); if (TakeContentChanged() || mApps == null || configChange) { // If the data has changed since the last time it was loaded // or is not currently available, start a load. ForceLoad(); } }
/** * Handles a request to completely reset the Loader. */ protected override void OnReset() { base.OnReset(); // Ensure the loader is stopped OnStopLoading(); // At this point we can release the resources associated with 'apps' // if needed. if (mApps != null) { OnReleaseResources(mApps); mApps = null; } // Stop monitoring for changes. if (mPackageObserver != null) { Context.UnregisterReceiver(mPackageObserver); mPackageObserver = null; } }