convert mMedia to a mutable list before providing to MyPagerAdapter
This commit is contained in:
parent
a355b0a7b8
commit
ce41e5b7b9
2 changed files with 3 additions and 3 deletions
|
@ -228,7 +228,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
|
||||
private fun updatePagerItems() {
|
||||
val pagerAdapter = MyPagerAdapter(this, supportFragmentManager, mMedia)
|
||||
val pagerAdapter = MyPagerAdapter(this, supportFragmentManager, mMedia.toMutableList())
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) {
|
||||
view_pager.apply {
|
||||
adapter = pagerAdapter
|
||||
|
|
|
@ -42,9 +42,9 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m
|
|||
return fragment
|
||||
}
|
||||
|
||||
override fun destroyItem(container: ViewGroup?, position: Int, `object`: Any?) {
|
||||
override fun destroyItem(container: ViewGroup?, position: Int, any: Any?) {
|
||||
mFragments.remove(position)
|
||||
super.destroyItem(container, position, `object`)
|
||||
super.destroyItem(container, position, any)
|
||||
}
|
||||
|
||||
fun getCurrentFragment(position: Int) = mFragments.get(position)
|
||||
|
|
Loading…
Reference in a new issue