I have a main Activity which XML holds a RelativeLayout with a ViewPager:
<android.support.v4.view.ViewPager
android:id="@+id/pager"
Then I have a FragmentStatePagerAdapter to manage the Fragment.
Now I have a public method on the Fragment called getFoo() (which obviously returns foo).
Question: What is the correct way to get the Fragment's foo from the main Activity?
I tried using addOnPageChangeListener() on the ViewPager, but then I'm not able to get the active instance of the Fragment.