Code example for FragmentManager

Methods: beginTransaction, findFragmentById

        FragmentManager fm = getSupportFragmentManager();
        // Create the list fragment and add it as our sole content. 
        if (fm.findFragmentById( == null) {
            ThrottledLoaderListFragment list = new ThrottledLoaderListFragment();
            fm.beginTransaction().add(, list).commit();
    public static class ThrottledLoaderListFragment extends ListFragment
            implements LoaderManager.LoaderCallbacks<Cursor> {
        // Menu identifiers 
        static final int POPULATE_ID = Menu.FIRST;
        static final int CLEAR_ID = Menu.FIRST+1;
        // This is the Adapter being used to display the list's data. 
        SimpleCursorAdapter mAdapter;