Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class ViewPagerAdapter(fm: FragmentManager?) : FragmentStatePagerAdapter(fm) {
private var mFragmentList: ArrayList<Fragment> = ArrayList()
private var mFragmentTitleList: ArrayList<String> = ArrayList()
fun addFragment(fragment: Fragment, s: String) {
mFragmentList.add(fragment)
mFragmentTitleList.add(s)
}
override fun getCount(): Int {
return mFragmentList.size
}
override fun getItem(n: Int): Fragment {
return mFragmentList[n]
}
override fun getPageTitle(n: Int): CharSequence? {
return mFragmentTitleList[n]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.