Code example for ListFragment

Methods: setEmptyTextsetListAdaptersetListShown, getActivity, getLoaderManager, onActivityCreated, setHasOptionsMenu

        // 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 phone numbers");
            // We have a menu item to show in action bar. 
            // Create an empty adapter we will use to display the loaded data. 
            mAdapter = new SimpleCursorAdapter(getActivity(),
                    android.R.layout.simple_list_item_2, null,
                    new String[] { Contacts.DISPLAY_NAME, Contacts.CONTACT_STATUS },
                    new int[] {, }, 0);
            // 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");