Fixed
Status Update
Comments
ia...@gmail.com <ia...@gmail.com> #2
Yes, this is correct. Having individual navigation graphs on each activities overrides or disallow up navigation to the main activity.
il...@google.com <il...@google.com> #3
I believe I have found the potential problem that is causing this:
// @ androidx.navigation.NavController
// line 124
// Now record the pop operation that we were sent
if (!mBackStack.isEmpty()) {
mBackStack.removeLast();
}
// We never want to leave NavGraphs on the top of the stack
while (!mBackStack.isEmpty()
&& mBackStack.peekLast() instanceof NavGraph) {
popBackStack();
}
the condition in while loop is never satisfied because of the above `if` statement above it has already removed the last item of the mBackStack (which was the NavGraph) and thus popBackStack() is never called again.
// @ androidx.navigation.NavController
// line 124
// Now record the pop operation that we were sent
if (!mBackStack.isEmpty()) {
mBackStack.removeLast();
}
// We never want to leave NavGraphs on the top of the stack
while (!mBackStack.isEmpty()
&& mBackStack.peekLast() instanceof NavGraph) {
popBackStack();
}
the condition in while loop is never satisfied because of the above `if` statement above it has already removed the last item of the mBackStack (which was the NavGraph) and thus popBackStack() is never called again.
ma...@gmail.com <ma...@gmail.com> #4
According to Ian Lake, NavigationUI does not support up navigation yet, that is why this is a feature request.
+Pedro Varela - we don't support navigating up through activities as part of NavigationUI yet, please star the feature request:https://issuetracker.google.com/issues/79993862 (this issue)
+Pedro Varela - we don't support navigating up through activities as part of NavigationUI yet, please star the feature request:
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #5
Ian Lake said Up navigation is not supported through activities, only through fragments.
il...@google.com <il...@google.com> #6
With the introduction of AppBarConfiguration, this is now possible with the setupActionBarWithNavController method by using an empty set of top level destinations (to always show the up button) and then overriding onSupportNavigateUp() as per the documentation: https://developer.android.com/topic/libraries/architecture/navigation/navigation-ui#action_bar
I'll leave this bug open as we still need an equivalent API for the Toolbar versions.
I'll leave this bug open as we still need an equivalent API for the Toolbar versions.
[Deleted User] <[Deleted User]> #7
This allows you to call onSupportNavigateUp() (or super.onSupportNavigateUp() if you're using an ActionBar) from that method to have your Up button transition between activities.
This will be available in 1.0.0-alpha09.
Description
Version used: 1.0.0-alpha01
Devices/Android versions reproduced on: Device running Android P, compiled in SDK 27
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue.
- A screenrecord or screenshots showing the issue (if UI related).
In order to instantiate the view of my first fragment, some data needs to be passed from the current Activity to the primary fragment. Currently, I don't see a clear way to do this. In the same way one can navigate from fragment to fragment while passing arguments via the NavController's navigate method, it would be helpful if there was some method to pass a bundle to the first nav fragment and update the graph associated with the NavHostFragment before inflating the view.
Please do let me know if there is some way to do this that I'm missing. Currently I'm setting up a dummy fragment to start with that will manage passing the data to the intended first fragment.