Code example for ListFragment

Methods: getActivity, getArguments

0
        getLoaderManager().initLoader(0, null, this);
    } 
 
    @Override 
    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
        Uri uri = Uri.parse(getArguments().getString(ARG_URI));
        return new CursorLoader(getActivity(), uri, null, null, null, null);
    } 
 
    @Override 
    public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
        adapter.swapCursor(cursor);
        setListShown(true);
        setEmptyText(getString(R.string.empty_list));
    } 
 
    @Override 
    public void onLoaderReset(Loader<Cursor> loader) {
        adapter.swapCursor(null);
        // No ListView available at this time to update. 
    }