Code example for ListFragment

Methods: onActivityCreated, setListShown

0
        } 
    } 
 
    @Override 
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        setListShown(currentMovieList != null);
    } 
    /** 
     * If an a item is clicked then a the Movie Detail activity is launched, 
     * passing the corresponding MovieInfo bean in the intent extras. 
     */ 
    @Override 
    public void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        saveScrollPosition(l);
        Intent i = new Intent(getActivity(), MovieDetail.class);
        i.putExtra(MovieDetail.MOVIE_INFO_EXTRA, currentMovieList.get(position));
        startActivity(i);
    }