catching an exception at updating viewpager

This commit is contained in:
tibbi
2021-12-12 12:00:49 +01:00
parent 5f781cafe3
commit f7ee3feaec
2 changed files with 7 additions and 2 deletions

View File

@@ -63,7 +63,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:5566a9d221' implementation 'com.github.SimpleMobileTools:Simple-Commons:fd08255626'
implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2' implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

View File

@@ -811,8 +811,13 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun updateViewPager(dayCode: String? = Formatter.getTodayCode()) { private fun updateViewPager(dayCode: String? = Formatter.getTodayCode()) {
val fragment = getFragmentsHolder() val fragment = getFragmentsHolder()
currentFragments.forEach { currentFragments.forEach {
try {
supportFragmentManager.beginTransaction().remove(it).commitNow() supportFragmentManager.beginTransaction().remove(it).commitNow()
} catch (ignored: Exception) {
return
} }
}
currentFragments.clear() currentFragments.clear()
currentFragments.add(fragment) currentFragments.add(fragment)
val bundle = Bundle() val bundle = Bundle()