Code example for ListFragment

Methods: getActivity, onCreate, setRetainInstance

0
 
	private CursorAdapter mAdapter;
	 
	@Override 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setRetainInstance(true);
		mAdapter = new UsersAdapter(getActivity());
	} 
 
	@Override 
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		setListAdapter(mAdapter);
		getLoaderManager().initLoader(0, null, this);
	} 
 
	@Override 
	public void onListItemClick(ListView l, View v, int position, long id) {
		Cursor c = getActivity().getContentResolver().query(Uri.parse(C.BASE_URI + C.USERS + "/" + id), null, null, null, null);
		if (c.moveToNext()) {