I implement the bottom menu with three icons and, in order not to copy the code into 3 activations, I implemented a fragment, but the problem is to find out if the user has not clicked on an already open activation. That is, I need something like "getActivity! = OpenedActivity". How to implement it?

  • If the lower menu means something like BottomNavigationView , then you need one activation and several fragments that will be displayed by clicking in the BottomNavigationView . The connection between the Π½ΠΈΠΆΠ½Π΅Π΅ мСню с Ρ‚Ρ€Π΅ΠΌΠΈ ΠΈΠΊΠΎΠ½ΠΊΠ°ΠΌΠΈ and 3 Π°ΠΊΡ‚ΠΈΠ²ΠΈΡ‚ΠΈ incomprehensible. - post_zeew

1 answer 1

To implement the bottom menu use BottomNavigationView

BottomNavigationView has two listeners:

  • BottomNavigationView.OnNavigationItemReselectedListener
  • BottomNavigationView.OnNavigationItemSelectedListener

In case you select an item from the bottom menu already selected, the first driver will work, otherwise the second listener.