Created
June 19, 2018 09:32
-
-
Save mduisenov/895a6207750230bb0910414b10a05911 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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