Code example for ListFragment

Methods: getActivity, onCreate, setListAdapter

0
        restoreScrollPosition(); 
    } 
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ScrollView scroller = new ScrollView(getActivity());
        TextView text = new TextView(getActivity());
        int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getActivity()
                .getResources().getDisplayMetrics());
        text.setPadding(padding, padding, padding, padding);
        scroller.addView(text);
        /* 
         * Sets the list of MovieInfo beans to a MovieListAdapter, which is then 
         * set as the adapter for this activity. 
         */ 
        if (currentMovieList != null) {
            MovieListAdapter adapter = new MovieListAdapter(getActivity(), currentMovieList);
            setListAdapter(adapter);
            adapter.sortByTitle();
        } 
    } 
 
    @Override