I have an activity that contains navigation buttons in separate fragment and FrameLayout. FrameLayout contains content fragment that represents one of apps categories(Timeline, Profile, etc.). Clicking to navigations buttons allows to switch between content fragments(categories). Categories also have sub categories.
The question is how to make proper back navigation with separate back stack for each category, to switch between categories with last state(sub category fragment) remembering (to continue use from last state) also for each category. How to realize it?