avoid trying to refresh viewpager from wrong thread, or with invalid activity

This commit is contained in:
tibbi 2018-01-22 22:00:30 +01:00
parent e04b84c416
commit fbd37d4977
2 changed files with 5 additions and 2 deletions

View File

@ -557,7 +557,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
private fun refreshViewPager() { private fun refreshViewPager() {
currentFragments.last().refreshEvents() if (!isActivityDestroyed()) {
runOnUiThread {
currentFragments.last().refreshEvents()
}
}
} }
private fun tryImportEvents() { private fun tryImportEvents() {

View File

@ -1,7 +1,6 @@
package com.simplemobiletools.calendar.fragments package com.simplemobiletools.calendar.fragments
import android.support.v4.app.Fragment import android.support.v4.app.Fragment
import org.joda.time.DateTime
abstract class MyFragmentHolder : Fragment() { abstract class MyFragmentHolder : Fragment() {
abstract fun goToToday() abstract fun goToToday()