Code example for ListFragment

Methods: getActivity, getLoaderManager, onCreate, setListAdapter

0
 
	} 
 
	@Override 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setListAdapter(new PackageEventCursorAdapter(getActivity(), null));
		getLoaderManager().initLoader(0, null, this);
	} 
 
	public Loader<Cursor> onCreateLoader(int id, Bundle args) {
		return new CursorLoader(getActivity(), PackageEvent.CONTENT_URI, null, null, null, PackageEvent._ID + " DESC");
	} 
 
	public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
		((CursorAdapter) getListAdapter()).swapCursor(data);
	} 
 
	public void onLoaderReset(Loader<Cursor> loader) {
		((CursorAdapter) getListAdapter()).swapCursor(null);
	}