title: Custom ListView in Viewpager
body: <p>This is my page:</p>
  
  <pre><code>package[...]
  import [...]
  public class Home extends FragmentActivity {
      ViewPager mViewPager;
      ListView list;
      row_video_Adapter adapter;
      public  Home CustomListView = null;
      public  ArrayList&lt;ModelloLista&gt; CustomListViewValuesArr = new ArrayList&lt;ModelloLista&gt;();
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_home);
  
          // Create the adapter that will return a fragment for each of the three
          // primary sections of the app.
          mSectionsPagerAdapter = new SectionsPagerAdapter(
                  getSupportFragmentManager());
  
          // Set up the ViewPager with the sections adapter.
          mViewPager = (ViewPager) findViewById(R.id.pager);
          mViewPager.setAdapter(mSectionsPagerAdapter);
  
          // ListView
          CustomListView = this;
  
          /******** Take some data in Arraylist ( CustomListViewValuesArr ) ***********/
          setListData();
  
          Resources res =getResources();
          list= (ListView)findViewById(R.id.section_label);  // List defined in XML ( See Below )
  
          /**************** Create Custom Adapter *********/
          adapter=new row_video_Adapter(CustomListView, CustomListViewValuesArr,res);
          list.setAdapter(adapter);
      }
      /****** Function to set data in ArrayList *************/
      public void setListData(){
          final ModelloLista sched = new ModelloLista();
          sched.setTitolo("Video 1");
          sched.setImmagine("video_preview");
          sched.setUrl("http:\\www.com");
          CustomListViewValuesArr.add(sched);
      }
  
  
     /*****************  This function used by adapter ****************/
      public void onItemClick(int mPosition){
          ModelloLista tempValues = ( ModelloLista ) CustomListViewValuesArr.get(mPosition);
  
  
         // SHOW ALERT
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.home, menu);
          return true;
      }
      public class SectionsPagerAdapter extends FragmentPagerAdapter {
          public SectionsPagerAdapter(FragmentManager fm) {
              super(fm);
          }
  
          @Override
          public Fragment getItem(int position) {
              Fragment fragment = new DummySectionFragment();
              Bundle args = new Bundle();
              args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, position + 1);
              fragment.setArguments(args);
              return fragment;
          }
  
          @Override
          public int getCount() {
              // Show 5 total pages.
              return 5;
          }
  
          @Override
          public CharSequence getPageTitle(int position) {
              Locale l = Locale.getDefault();
              switch (position) {
              case 0:
                  return getString(R.string.title_section1).toUpperCase(l);
              case 1:
              [...]
              }
              return null;
          }
      }
      public static class DummySectionFragment extends Fragment {
          public static final String ARG_SECTION_NUMBER = "section_number";
          public DummySectionFragment() {
          }
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                  Bundle savedInstanceState) {
              View rootView = inflater.inflate(R.layout.fragment_home_dummy,
                      container, false);
              //TextView dummyTextView = (TextView) rootView.findViewById(R.id.section_label);
              switch(getArguments().getInt(ARG_SECTION_NUMBER)){
                  case 1:
                      //dummyTextView.setText("text 1");
                      break;
                  case 2:
                  [...]
              }
              return rootView;
          }
      }
  }
  </code></pre>
  
  <p>How can I put my Custom ListView in a fragment?
  I tried to move the code in the <code>switch(getArguments().getInt(ARG_SECTION_NUMBER)){</code> but there were many errors.
  What should I do?</p>