FragmentStatePagerAdapter(for short FSPA) has pre-load mechanism.
We assume that A,B and C Fragment in FSPA
When user select the A Fragment, the B fragment will be pre-load, something in B fragment don't want to be executed because B is not the current fragment.
How cloud i determine if a fragment is a current fragment user selected ?
The code snippet can't explain what i want to do, so i have deleted it
Update my question as below :
Assume that
- there are three fragments A , B, C in viewPager
- fragment A is the first visible to user.
- start e-ticket transaction if fragment A is visible to user
- In other page (except fragment A), we need to stop e-ticket transaction
Problem: Pre-load fragment A in viewpager will cause that user don't see a e-ticket present but e-ticket start transaction
Want to do: View of fragment A is a e-ticket, so transaction can be started in fragment A only and stop in other fragment.
p.s. start and stop e-ticket transaction are in A fragment class.