Code example for ListFragment

Methods: getActivity, onCreate, setRetainInstance

0
 
	private UsersAdapter 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) {
		Bundle args = new Bundle();
		args.putLong(C.ID, id);