You’re using an ActionBar with Tabs and want to add to backstack, but you see the above error.

While this is a fairly reasonable user experience assertion for the framework to make (in general, you probably shouldn’t be adding tab fragments to backstack), like most UX best-practices, it should be considered a guideline and not a hard and fast rule (e.g., say you want an ActionBar with tabs to be the sole means of navigating your app – without any other Activities that might clutter or confuse the normal history stack?)

Anyway, the boards are littered with either sermons against deviating from the guideline or very long workarounds. While I admire the author’s determination, and think the basic concept could be cool in another context (e.g., micro-managing history in a non-standard app), this solution isn’t really necessary.

The answer is to just get your own FragmentTransaction, and not use the one provided by the TabListener method, like so: