H
H
h1_0ne2020-05-02 06:10:24
Android
h1_0ne, 2020-05-02 06:10:24

How to set OnClick on back button in fragment?

Good afternoon. After creating a fragment and switching to it view!!.findNavController().navigate(fragment), by default I have an arrow in the upper left corner. The problem is that when you click on it, nothing happens, although with all its appearance it makes it clear that on click it should return to the previous fragment. How to set this behavior for the arrow? Somehow through xml, or set it to onClick? If asked, how? I googled about redefinition onOptionsItemSelected, but by clicking on the arrow, the application does not enter this function. Worth true on
setDisplayHomeAsUpEnabledandsetHomeButtonEnabled5eace49dd0b61121634070.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timur Pokrovsky, 2020-05-02
@Makaroshka007

https://stackoverflow.com/questions/35810229/how-t...
https://freakycoder.com/android-notes-24-how-to-ad...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question