title: Custom Back Button behaviour in Fragment, using Navigation graph
body: <p>I am writing a game in which one fragment is loaded several times successively with an increasing number of elements on the screen, so that the difficulty increases. I do this with a Navigation graph in which the level has an action to self in which it passes new parameters each time. So far so good.</p>
  
  <p>The only problem is the BackStack: If I keep the default behaviour, it goes back to the same fragment, but with some weird changes in the score numbers. If I set it to go straight back to the main menu, the user might hit the back button by mistake an end up losing their progress. </p>
  
  <p>So I want to display an alert dialog prompting a decision to either resume game or go back to main menu.</p>
  
  <p>I know how to create the dialog but how do I show it when back is pressed? Trying to override <code>onBackPressed()</code>, <code>onNavigateUp()</code> and <code>onSupportNavigateup()</code> each give me an "overrides nothing" message. What else could I try?</p>