android – Navigation Drawer calling Activity – Close menu by clicking Activity item if it is current


I created a navigation Drawer. To use in several Activities using a default class for it ( ) and extend it in Activities where I want the Navigation Drawer to open, but I have the following problem:

If I'm in Activity Home, I open the menu and click on the item corresponding to activity Home, it is reloaded, how can I test the OnNavigationItemSelected() method of my DrawerBase class to check if the item I clicked to open is the one from the activity that I am already and call the command to close the drawer instead of reloading the activity ?


You can do it another way, add a rule to the manifest:


So it won't reload the same activity again.

Scroll to Top