GetChildFragmentManager () method - undefined

I have a SherlockFragmentActivity function, this activity has SectionsPagerAdapter and ViewPager. When I call the SectionsPagerAdapter constructor using the getChildFragmentManager() method, it shows me this error message:

The getChildFragmentManager () method is undefined for the ViewPagerActivity type

This is my code:

 public class ViewPagerActivity extends SherlockFragmentActivity implements OnPageChangeListener, OnQueryTextListener{ private SectionsPagerAdapter sectionsPagerAdapter; private ViewPager viewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_view_pager); sectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager(), this); viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setAdapter(sectionsPagerAdapter); viewPager.setOnPageChangeListener(this); this.getMovements(); this.getPrizes(); this.getVouchers(); this.createDropdownlist(); } 

I am using ActionBarSherlock, and I updated android-support-v4.jar using the "Android Tools - Add Support Library" in my project, also in the ActionBarSherlock project.

I do this because I need to have a ListFragment inside the fragment that I use as a page on my ViewPager.

+7
source share
1 answer

getChildFragmentManager() is a method on Fragment , not on FragmentActivity . Use getSupportFragmentManager() on a FragmentActivity .

+23
source

All Articles