android - Lifecycle of Fragment that holds a ViewPager -


i have has me stumped. have fragment (fragment a) has viewpager contains 3 fragments (for swiping left/right). so, if within fragment, in onbackpressed() method, getfragmentmanager().popbackstack() call, fragment again visible (with viewpager of sub-fragments) desired state. however, there no method fragment or within viewpager indicates fragment a/viewpager again visible.

none of fragment methods referenced in fragment lifecycle (http://developer.android.com/guide/components/fragments.html) should called when "the fragment returns layout stack" or of methods called within onpagechangelistener (yes, call viewpager.setonpagechangelistener(this) within fragment a's oncreateview).

thoughts on look?

i have app viewpager added layout, later replaced fragment, change added transaction stack. have log statements in each of lifecycle methods of pager. when button pressed , pager returned layout, logcat output shows these methods called pager: oncreateview(), onactivitycreated(), onstart(), onresume(). note when fragment goes stack, view destroyed, fragment object not destroyed, when fragment returns stack, there no call oncreate().

this behavior consistent lifecycle diagram in fragment guide. should able use call onresume() indication pager visible. can suggest add debug output lifecycle methods pager , @ output. if think wrong, please add post of question. indicate fragment transaction method(s) using. if chance using hide() instead of remove() or replace(), lifecycle events different , may need use onhiddenchanged().


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -