Code example for ListFragment

Methods: getListView, isAdded, onSaveInstanceState

0
	public void onDestroyOptionsMenu() { 
	} 
 
	@Override 
	public void onSaveInstanceState(Bundle outState) {
		if (isAdded()) {
			View v = getListView().getChildAt(0);
			int top = (v == null) ? 0 : v.getTop();
			outState.putInt(STATE_POSITION, getListView().getFirstVisiblePosition());
			outState.putInt(STATE_TOP, top);
		} 
		super.onSaveInstanceState(outState);
	} 
 
	public void refresh(String newQuery) {
		mSearchString = newQuery;
		refresh(true); 
	} 
 
	public void refresh() { 
		refresh(false);