Handle back pressed of multiple fragments in android -


hi developing application using fragments.totally have 15 fragments , loaded in single activity.while onback pressing on each fragment launch previous fragment.i google , got answers it.but want know more efficient way handle this.

by calling addtobackstack(), replace transaction saved stack user can reverse transaction , bring previous fragment pressing button. reference

if add multiple changes transaction (such add() or remove()) , call addtobackstack(), changes applied before call commit() added stack single transaction , button reverse them together.

just add transaction.addtobackstack(null);

for more information may visit handling button press inside fragments


Comments

Popular posts from this blog

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

javascript - Handling constructor related functions while testing with mocha and sinon -