Code example for ListFragment

Methods: getListView, isAdded, onSaveInstanceState

0
        setListAdapter(mStreamAdapter);
    } 
 
    @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);
    } 
 
    @Override 
    public void onListItemClick(ListView l, View v, int position, long id) {
        if (mCursor == null) {
            return; 
        } 
 
        mCursor.moveToPosition(position);