Problem: Fragment onResume()
in ViewPager
is fired before the fragment becomes actually visible.
For example, I have 2 fragments with
I figured out that onCreateOptionsMenu
and onPrepareOptionsMenu
methods called only in the case of the fragment really visible. I could not found any method which behaves like these, also I tried OnPageChangeListener
but it did not work for the situations, for example, I need a variable initialized in onCreate
method.
So these two methods can be used for this problem as a workaround, specifically for little and short jobs.
I think, this is the better solution but not the best. I will use this but wait for better solution at the same time.
Regards.