robnik
04/30/2021, 4:43 PMZach Klippenstein (he/him) [MOD]
04/30/2021, 4:45 PMBackHandler
with an event handler that pops your backstackrobnik
04/30/2021, 4:57 PMBackHandler
. Perfect, thanks! By "backstack" do you mean something in the system API that I need to hook into, or do you just mean whatever stack/nav system I'm implementing? I'm clear how to implement my version of "back", but I'm not sure how to know when the user intends to go "back" out of my app.Zach Klippenstein (he/him) [MOD]
04/30/2021, 5:36 PMBackHandler
if your stack is size 1Ian Lake
04/30/2021, 7:15 PMenabled
parameter of BackHandler
for the stack size, not just conditionally including the BackHandler
. As per the custom back docs (https://developer.android.com/guide/navigation/navigation-custom-back), the ordering of `BackHandler`s is important for dispatch - you'd want to maintain the correct place in the list as it were compared to parent, sibling, and child BackHandler
instancesIan Lake
04/30/2021, 7:16 PMBackHandler
does have its use cases (say, for a side nav drawer that needs to be at the top of the dispatch queue when it is open, no matter what `BackHandler`s the underlying content have), it just isn't the right one for the back stack size case