How/When do I initialize a Fragment added via XML?
===

I have a 2 pane view that is defined in XML. For xlarge, the left side of the view is a Fragment that deals with content selection. I want to initialize this selector `ListFragment` to have the first item highlighted on app start up.

I've written a method in the `ListFragment` to do this:

    public void setSelectedItem (int position) {
        //Unselect the previous item
        if(mPreviousPosition != ListView.INVALID_POSITION) {
            View oldSelected = getListView().getChildAt(mPreviousPosition);
            oldSelected.setBackgroundResource(R.drawable.menu_button);
            ((ImageView) oldSelected.findViewById(R.id.selector_icon)).setImageDrawable(icons.getDrawable(mPreviousPosition));
            ((TextView) oldSelected.findViewById(R.id.selector_text)).setTextAppearance(getActivity(), R.style.text_selector);
		}
		
        //Select this item
        View newSelected = getListView().getChildAt(position);
        newSelected.setBackgroundResource(R.drawable.menu_button_active);
        ((ImageView) newSelected.findViewById(R.id.selector_icon)).setImageDrawable(icons_active.getDrawable(position));
        ((TextView) newSelected.findViewById(R.id.selector_text)).setTextAppearance(getActivity(), R.style.text_selector_active);
		
        mPreviousPosition = position;
	}

When I call this after an item has been selected, it works great. But when I try highlight the first item on startup, I get a NPE at 

    newSelected.setBackgroundResource(R.drawable.menu_button_active);

It seems `getListView().getChildAt(position)` is returning `null` because the Fragment's view hasn't been created yet.

So, from where in my Activity is it safe to try initialise the `ListFragment`? I've tried in onStart, onRestoreInstanceState and onResume but they all produce the NPE.