Wednesday, 15 August 2012

android - Pop back stack without onresume called -



android - Pop back stack without onresume called -

i got activity a. set b in backsatck , display it; want phone call c such not called 1 time again want pop b backstack such homecoming c want returns a. here scenario: a->b c called: a->c c closed onback pressed: homecoming when pop b backstack (in order replace c) fragment onresume called , not allow b displayed normally. used:

fragmentmanager.popbackstack(null,fragmentmanager.pop_back_stack_inclusive);`

however not prepare problem. here code switchfragments:

fragmentmanager.popbackstack(null, fragmentmanager.pop_back_stack_inclusive); if (fragment != null) { fragmenttransaction transaction = fragmentmanager .begintransaction(); transaction.replace(r.id.content_frame, fragment, tag); // articldetailfragment added stack. if (!(fragment instanceof homefragment) /* && isitnotification == false */) { if (debug == 1) log.v("debug_tag", "mainacitivy switchcontent2"); transaction.addtobackstack(tag); } transaction.commit(); contentfragment = fragment; }

homefragment called here.

instead of replacing fragment add together them in backstack :

getfragmentmanager().begintransaction().add(r.id.content_frame, fragment).addtobackstack(null).commit();

android android-fragments fragmentmanager

No comments:

Post a Comment