Code example for FragmentManager

Methods: beginTransaction, findFragmentById

0
        super.onCreate(savedInstanceState);
 
        FragmentManager fm = getSupportFragmentManager();
 
        // Create the list fragment and add it as our sole content. 
        if (fm.findFragmentById(android.R.id.content) == null) {
            AppListFragment list = new AppListFragment();
            fm.beginTransaction().add(android.R.id.content, list).commit();
        } 
    } 
 
 
    /** 
     * This class holds the per-item data in our Loader. 
     */ 
    public static class AppEntry { 
        public AppEntry(AppListLoader loader, ApplicationInfo info) {
            mLoader = loader;
            mInfo = info;
            mApkFile = new File(info.sourceDir);
        }