Code example for ListFragment

Methods: onViewCreatedsetListAdapter, getActivity, getLoaderManager

0
 
    private PartiesAdapter adapter;
 
    @Override 
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
 
        getLoaderManager().initLoader(LoaderId.getId(), null, this);
 
        adapter = new PartiesAdapter(getActivity(), null);
 
        setListAdapter(adapter);
    } 
 
    @Override 
    public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
        return new CursorLoader(getActivity(), PartyContract.URI, null, null, null, null);
    } 
 
    @Override 
    public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {