I am making a simple note taking app, I have 2 fragments with navigation component, one fragment has a list of notes and the other is for editing or creating a new note.

In `MainActivity` I added 

```
val navController = this.findNavController(R.id.host_fragment)
NavigationUI.setupActionBarWithNavController(this, navController)

```

and then override `onSupportNavigateUp()`

```
override fun onSupportNavigateUp(): Boolean {
        val navController = this.findNavController(R.id.host_fragment)
        return navController.navigateUp()
    }

```

In `NoteEditFragment`

```
requireActivity().onBackPressedDispatcher.addCallback(this) {
        saveOrUpdateNote(noteId, note)
    }

```

now it all works well when pressing the "back button" in the device, However `onBackPressedDispatcher.addCallback()` is note triggered when I press the "up button" the one on the top left of the screen.

My question is : How do I handle this up button from my `NoteEditFragment`?

Thanks in advance