I have a few Fragments in a ViewPager, and I've found the Fragment's onActivityCreated
and onCreateView
are both being called on the page before I expect.
For example, when the ViewPager transitions from page 2 to 3, then the Fragment at page 4's onCreateView
and onActivityCreated
are being called.
I'm intending to initiate a network request in onActivityCreated
but it is starting one screen too soon. According to the Android docs, onActivityCreated
is called "when the fragment's activity has been created and this fragment's view hierarchy instantiated." which leads me to believe I'm using the method correctly.