S
S
SVM122015-02-25 15:03:19
Android
SVM12, 2015-02-25 15:03:19

How to navigate back to a specific activity?

In general, there is an activity that emulates working with a tree.
The id_parent is passed to him in the Intent. id_parent=0 is the root of the tree. The investment is not limited in any way.
The back button navigates to the parent element.
I want to make a transition to the root of the tree by long pressing the back button. I know how to hang up an event for a long press of the button back (back).
The question arose of how to go to the root (Intent: id_parent=0) without breaking the navigation history?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SVM12, 2015-03-02
@SVM12

I solved the problem by maintaining my own navigation stack Stack<Activity>and sequentially calling the finish () method of the activity in the stack with a long press on the "back" button.

V
Vladimir Yakushev, 2015-03-06
@VYakushev

In my opinion, it is more correct to solve this issue not with the activity stack, but with the fragment stack with the redefinition of the back button.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question