Class PagerAdapter


  • public class PagerAdapter
    extends androidx.fragment.app.FragmentPagerAdapter
    Generic adapter for displaying fragments in a ViewPager
    • Field Summary

      • Fields inherited from class androidx.fragment.app.FragmentPagerAdapter

        BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT, BEHAVIOR_SET_USER_VISIBLE_HINT
      • Fields inherited from class androidx.viewpager.widget.PagerAdapter

        POSITION_NONE, POSITION_UNCHANGED
    • Constructor Summary

      Constructors 
      Constructor Description
      PagerAdapter​(androidx.fragment.app.FragmentManager fm, java.util.List<androidx.fragment.app.Fragment> pages)
      Default constructor
      PagerAdapter​(androidx.fragment.app.FragmentManager fm, java.util.List<androidx.fragment.app.Fragment> pages, java.util.List<java.lang.String> pageTitles)
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCount()  
      androidx.fragment.app.Fragment getItem​(int position)  
      java.lang.CharSequence getPageTitle​(int position)  
      • Methods inherited from class androidx.fragment.app.FragmentPagerAdapter

        destroyItem, finishUpdate, getItemId, instantiateItem, isViewFromObject, restoreState, saveState, setPrimaryItem, startUpdate
      • Methods inherited from class androidx.viewpager.widget.PagerAdapter

        destroyItem, finishUpdate, getItemPosition, getPageWidth, instantiateItem, notifyDataSetChanged, registerDataSetObserver, setPrimaryItem, startUpdate, unregisterDataSetObserver
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PagerAdapter

        public PagerAdapter​(@NonNull
                            androidx.fragment.app.FragmentManager fm,
                            java.util.List<androidx.fragment.app.Fragment> pages)
        Default constructor
        Parameters:
        fm - fragment manager
        pages - fragments to be shown
      • PagerAdapter

        public PagerAdapter​(@NonNull
                            androidx.fragment.app.FragmentManager fm,
                            java.util.List<androidx.fragment.app.Fragment> pages,
                            java.util.List<java.lang.String> pageTitles)
        Default constructor
        Parameters:
        fm - fragment manager
        pages - fragments to be shown
        pageTitles - tab names
    • Method Detail

      • getItem

        @NonNull
        public androidx.fragment.app.Fragment getItem​(int position)
        Specified by:
        getItem in class androidx.fragment.app.FragmentPagerAdapter
      • getCount

        public int getCount()
        Specified by:
        getCount in class androidx.viewpager.widget.PagerAdapter
      • getPageTitle

        @Nullable
        public java.lang.CharSequence getPageTitle​(int position)
        Overrides:
        getPageTitle in class androidx.viewpager.widget.PagerAdapter