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 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 onListItemClick(ListView l, View v, int position, long id) {
            // Insert desired behavior here. 
            Log.i("LoaderCustom", "Item clicked: " + id);