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
Post a Comment