Code example for ListFragment

Methods: setListAdapter, getActivity, onCreate

0
    public GFMainListFragment() { 
    } 
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setListAdapter(new ArrayAdapter<String>(getActivity(),R.layout.simple_list_item_activated_1,R.id.text1,new String [] {"GitFit Workouts","My Workouts","Custom Workouts","FitRun","Settings"}));
//        setListAdapter(new ArrayAdapter<DummyContent.DummyItem>(getActivity(), 
//                R.layout.simple_list_item_activated_1, 
//                R.id.text1, 
//                DummyContent.ITEMS)); 
    } 
 
    @Override 
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        if (savedInstanceState != null && savedInstanceState
                .containsKey(STATE_ACTIVATED_POSITION)) {
            setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
        }