
The code inside ‘onNavigationItemSelected’ method is simply displaying a toast message. Then we add a ‘setNavigationItemSelectedListener’ on the ‘nv’ variable, which is the navigation view, to listen for any click events on selecting a particular item from the drawer.

In lines 14–16 we declare instance variables required for the navigation drawer and we later find them using the findViewById method inside the onCreate() function. For this one, it is highly recommended to learn Java as it is the official Android language.


Rename the package name to whatever you had chosen in the beginning, you can find the package name in the Manifest.xml file.
