Mathbl
01/31/2018, 3:15 PMlateinit var
ex.:
@BindView(R.id.swipe_refresh_layout) lateinit var swipeRefreshLayout: SwipeRefreshLayout
, that's fine right?
To be able to show the loading animation of SwipeRefreshLayout programmatically, I use this method:
fun showLoading() {
<http://swipeRefreshLayout.post|swipeRefreshLayout.post>({
swipeRefreshLayout.isRefreshing = true
})
}
This is inside a fragment, inside a viewpager/tabs. Thing is, I have a case (I supposed that it's because I unbind in onDestroyView) where sometimes the swipeRefreshLayout variable is null once inside the post block. It seems it has to do with the tab/fragment not being visible so I thought I'd check inside post if (isAdded) but no luck there. Any idea?gildor
01/31/2018, 3:19 PMMathbl
01/31/2018, 3:24 PMMathbl
01/31/2018, 3:25 PMgildor
01/31/2018, 3:26 PMgildor
01/31/2018, 3:26 PMMathbl
01/31/2018, 3:27 PMgildor
01/31/2018, 3:28 PMswipeRefreshLayout?.isRefreshing = true
much better than isInitilized check.gildor
01/31/2018, 3:29 PM