android - Clear backstack and replace current fragment with a top-level fragment -


I have an activity in my Android app that controls the replacement of multiple views / pieces, top-level in this activity There is also a navigation drawer to navigate the pieces. You can navigate to the detail-level pieces with the top-level pieces.
Navigation drawer can always be accessed by sliding it from the left if the current piece is a top-level piece, navigation-drawer can also be accessed by the action-bar. If the current piece is an extension-level piece, you can navigate back through action-times (or by pressing the back button).

Let's say that I have three top-level pieces that can be accessed through the navigation drawer. From , piece [2] section [1] , you can navigate to the extension-level section [1.1] .

The user now wants to navigate directly from the top level section [3] to the current section [1.1] . The user simply needs to slide in the navigation drawer and click on the item for piece [3] .
Now, if the user hits the back button, then the application should be closed (because it was a top-level piece navigated). Therefore, backstacks should be cleaned every time the user navigates to the top-level piece. To see if I should display a drawer indicator, I am reading getBackStackEntryCount () - and compare it to 0.

As a summary, I want to navigate to any top-level pieces from the extension-level pieces and clean the backstacks.

Issue:
When I clear the backstack by executing getSupportFragmentManager (). PopBackStackImmediate (empty, piece manager. POP_BACK_STACK_INCLUSIVE); , Piece transactions are replayed in reverse (for example, piece [1] to piece [1.1] replacement). And I do not want them to play again. I have a lot of initialization on catevu, onview, onstart, .., also starting the work to bring the data. And I want to leave all this with just a new top-level one, instead of the detail level scene which was not already in the backstack.

I did not find any solution to clear the backstack without removing any pop-up transactions. Clean solution to handle this problem? Do I have to implement my backstack behavior?

Edit: The YouTube app also behaves this way. When you navigate from details to upper-level, the backstack is cleared. But how do they clean backstacks without running pieces-transection?

Thank you for your reply.

I think your problem is that you are pulling pieces in a loop - I think I usually specify custom animations as well as pieces on pieces - slide from the right to the new piece and when we press it we get out of the right now - if your user has 1 piece 1.1 and Navigate to 1.2 etc. and you want to navigate once again. Yes, when a user clicks the Home button in the action bar - specify the name of the name for you. If you popping using that name, consider using the popback stack function instead of the popback stacks Imprand.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -