Fixed
Status Update
Comments
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
il...@google.com <il...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit d0a10be065a3a629e3835f28d35804c91d8d2e4d
Author: Ian Lake <ilake@google.com>
Date: Mon Sep 14 16:10:06 2020
Mention the current destination in getBackStackEntry errors
Improve the debugging experience for "No destination
with ID..." errors in getBackStackEntry() by mentioning
exactly destination the NavController is on. This would
allow developers to know if they have called popBackStack()
to a destination they don't expect to be at or if
they have not called setGraph() at all (where the
current destination would be null).
Test: existing tests pass
BUG: 168311416
Change-Id: Ia96b6732d7caadbddf31b7f35a1a419407ff6e25
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.java
https://android-review.googlesource.com/1427352
Branch: androidx-master-dev
commit d0a10be065a3a629e3835f28d35804c91d8d2e4d
Author: Ian Lake <ilake@google.com>
Date: Mon Sep 14 16:10:06 2020
Mention the current destination in getBackStackEntry errors
Improve the debugging experience for "No destination
with ID..." errors in getBackStackEntry() by mentioning
exactly destination the NavController is on. This would
allow developers to know if they have called popBackStack()
to a destination they don't expect to be at or if
they have not called setGraph() at all (where the
current destination would be null).
Test: existing tests pass
BUG: 168311416
Change-Id: Ia96b6732d7caadbddf31b7f35a1a419407ff6e25
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.java
ma...@marcardar.com <ma...@marcardar.com> #3
We've updated the error message to make it more clear what destination you're currently on - this will help you determine if your call to setGraph()
hasn't happened yet (you have a null current destination) or if you've popped to another destination unexpectedly.
Description
Version used: 1.0.0-alpha07
Devices/Android versions reproduced on: Android 8.1
This is a feature request.
In my Nav drawer I have a Settings item. Currently, using the Nav Architecture component, clicking this causes the current back stack to be popped up to (not including) the start destination, and then the Settings fragment is added on top of that. I would like to be able to customise this so that the pop does not occur - i.e. that the Settings fragment is simply placed on top of the current destination. Anyway, isn't this what the user would expect for a Settings screen?
The key method call seems to be on the second line of NavigationUI.setupWithNavController() where popUp = false is passed. Maybe whether to popUp or not could be specified in the nav_graph destination?