I am creating an app where creating tabs using FragmentPagerAdapter
. When first time the tabs will be loaded by default the 1st tab will be selected. But after switch to another tab when user will return on the first tab again it will check some data in database and based on the data it will show content on first tab. So I am not sure where I should call the function to check in database? onTabSelected()
or onTabReselected()
?
onTabReselected : Called when a tab that is already selected is chosen again by the user. Some applications may use this action to return to the top level of a category.
and
onTabSelected : is called when a tab enters the selected state (it's previous state was unselected).
you should just keep a member variable as a counter and in onTabSelected when the specified tab is selected the second time do what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With