android - Fragment OnResume() after OnPause() -
i have application, part of fragment in camera takes pic, when picture taken fragment loaded display image. user has choice retake pic if not happy. should go previous fragment (camera) , overlay displayed, image taken still displayed.
edit** debugged through , when image taken , next fragment loaded, onpause() isn't called, so, when user clicks retake, onresume isnt called reinstantiates camera. know there have been similar questions here can't seem find answer problem.**edit
it should said integrating elses work here , causing confusion. here 2 methods going next fragment , going previous fragment
next
public void gotonextfragment(string nexttag, fragment nextfragment){ fragmentmanager fm = getsupportfragmentmanager(); fragmenttransaction ft = fm.begintransaction(); ft.setcustomanimations(r.animator.enter_slide_in, r.animator.enter_slide_out); boolean newlycreated = false; if(nextfragment == null){ nextfragment = fragment.instantiate(this, nexttag); newlycreated = true; } //hide current fragment ft.hide(fm.findfragmentbytag(misc.currentcontentfragmenttag)); if(newlycreated){ ft.add(r.id.content_frame, nextfragment, nexttag); } else{ ft.show(nextfragment); } ft.addtobackstack(null); ft.commit(); misc.currentcontentfragmenttag = nexttag; }
previous
public void gobacktopreviousfragment(string prefragmenttag,fragment f){ fragmentmanager fm = getsupportfragmentmanager(); fragmenttransaction ft = fm.begintransaction(); ft.setcustomanimations(r.animator.close_slide_in,r.animator.close_slide_out); ft.show(f); ft.remove(fm.findfragmentbytag(misc.currentcontentfragmenttag)); ft.addtobackstack(null); ft.commit(); misc.currentcontentfragmenttag = prefragmenttag; }
if have insight need ensure onresume() called i'd appreciate it...
edit image preview still displayed of standard camera image preview, not fragment previewing
when hide()
show()
fragments don't call onresume()
. call first time fragment created.
Comments
Post a Comment