Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It looks like your main activity is using the getSupportFragmentManager() while your fragment is using getFragmentManager().</p> <p>Not sure if this is worthy of an answer post but my rating is too low to reply any other way. :)</p> <p>Edit: I believe you may also need to extend a FragmentActivity with the support library.</p> <p>See: <a href="https://stackoverflow.com/a/10609839/2640693">https://stackoverflow.com/a/10609839/2640693</a></p> <p>Edit 2:</p> <pre><code>public class MainActivityFragment extends FragmentActivity { private ViewPager mPager = null; private PagerAdapter mPageAdapter = null; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View reVal = inflater.inflate(R.layout.activity_main, container, false); mPager = (ViewPager) reVal.findViewById(R.id.pagerMainContent); mPageAdapter = new ScreenSlidePagerAdapter(getChildFragmentManager()); mPager.setAdapter(mPageAdapter); return reVal; } private MainGridViewFragment mainGridFragment; private AlphabetGridViewFragment alphabetGridFragment; private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter { public ScreenSlidePagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { switch (position) { case 1: mainGridFragment = new MainGridViewFragment(); return (Fragment)mainGridFragment; case 0: alphabetGridFragment = new AlphabetGridViewFragment(); return (Fragment)alphabetGridFragment; default: return null; } } @Override public int getCount() { return 2; } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload