Code example for ListFragment

Methods: getActivity, getLoaderManager, onActivityCreated, setEmptyText, setHasOptionsMenu, setListAdapter, setListShown

        // If non-null, this is the current filter the user has provided. 
        String mCurFilter;
        @Override public void onActivityCreated(Bundle savedInstanceState) {
            // Give some text to display if there is no data.  In a real 
            // application this would come from a resource. 
            setEmptyText("No applications");
            // We have a menu item to show in action bar. 
            // Create an empty adapter we will use to display the loaded data. 
            mAdapter = new AppListAdapter(getActivity());
            // Start out with a progress indicator. 
            // Prepare the loader.  Either re-connect with an existing one, 
            // or start a new one. 
            getLoaderManager().initLoader(0, null, this);
        @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
            // Place an action bar item for searching. 
            MenuItem item = menu.add("Search");