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

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -