Code example for ViewPager

Methods: setAdapter, setId

0
        return f;
    } 
     
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {        
        ViewPager pager = new ViewPager(getActivity());
        pager.setId(0xFace); // Book. 
         
        ArrayList<Conference> conferences = getArguments().getParcelableArrayList("conferences");
        pager.setAdapter(new ConferencesAdapter(getChildFragmentManager(), conferences));
         
        return pager;
    } 
     
    public static class ConferenceFragment extends SherlockFragment { 
         
        private ImageView mImage;       
        private TextView mName;
        private TextView mSpeaker;
        private TextView mLocation;
        private TextView mDate;