Code example for FragmentActivity

Methods: getContext

2
            super(context);
 
            // Retrieve the package manager for later use; note we don't 
            // use 'context' directly but instead the save global application 
            // context returned by getContext(). 
            mPm = getContext().getPackageManager();
        } 
 
        /** 
         * This is where the bulk of our work is done.  This function is 
         * called in a background thread and should generate a new set of 
         * data to be published by the loader. 
         */ 
        @Override public List<AppEntry> loadInBackground() {
            // Retrieve all known applications. 
            List<ApplicationInfo> apps = mPm.getInstalledApplications(
                    PackageManager.GET_UNINSTALLED_PACKAGES |
                    PackageManager.GET_DISABLED_COMPONENTS);
            if (apps == null) {
                apps = new ArrayList<ApplicationInfo>();
            }