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

javascript - Can Piwik report referrer in real time? -

asp.net - Google Drive Access: At least one client secrets (Installed or Web) should be set -

excel vba add hyperlink to shape in group -