Code example for ListFragment

Methods: getActivity, getListView, getLoaderManager, onActivityCreated, setEmptyText, setListShown

0
		// getLoaderManager().initLoader(0, null, this); 
	} 
 
	@Override 
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		/* Cursor Loader */ 
		setEmptyText("No indicators found");
 
		// myAdapter = new AreaCursorAdapter(); 
 
		// setListAdapter(mAdapter); 
		setListShown(false);
		getLoaderManager().initLoader(0, null, this);
 
		try { // Check if the parent activity is the IndicatorActivity 
			hAct = (HomeActivity) getActivity();
			myAdapter.setSelectedPosition(-1, getListView());
		} catch (ClassCastException actException) {
			act = (IndicatorActivity) getActivity();
			myAdapter.setSelectedPosition(act.getPosition(), getListView());
			getListView().setSelection(act.getPosition());
			/* 
			 * if (act == null) { Log.d(TAG, 
			 * "Indicator activity variable is null"); Bundle data = 
			 * getActivity().getIntent().getExtras(); 
			 *