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) {
            CursorLoaderListFragment list = new CursorLoaderListFragment();
            fm.beginTransaction().add(, list).commit();
    public static class CursorLoaderListFragment extends ListFragment
            implements LoaderManager.LoaderCallbacks<Cursor> {
        // This is the Adapter being used to display the list's data. 
        SimpleCursorAdapter mAdapter;
        // If non-null, this is the current filter the user has provided. 
        String mCurFilter;