Code example for FragmentActivity

Methods: forceLoad, getContext, isReset, isStarted, takeContentChanged

0
         * 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(List<AppEntry> apps) {
            if (isReset()) {
                // An async query came in while the loader is stopped.  We 
                // don't need the result. 
                if (apps != null) {
                    onReleaseResources(apps);
                } 
            } 
            List<AppEntry> oldApps = apps;
            mApps = apps;
 
            if (isStarted()) {
                // If the Loader is currently started, we can immediately 
                // deliver its results. 
                super.deliverResult(apps);
            } 
 
            // At this point we can release the resources associated with 
            // 'oldApps' if needed; now that the new result is delivered we 
            // know that it is no longer in use. 
            if (oldApps != null) {
                onReleaseResources(oldApps);
            } 
        } 
 
        /** 
         * Handles a request to start the Loader. 
         */ 
        @Override protected 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? 
            boolean configChange = mLastConfig.applyNewConfig(getContext().getResources());
 
            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 stop the Loader.