onNavigationItemSelected not working in NavigationView

Matt Hutchings picture Matt Hutchings · Sep 10, 2016 · Viewed 25.8k times · Source

Please can someone help me with fragments from the navigation drawer, for some reason I can't get them to work and all the code looks right.

Here is the link to the source code.

Answer

Vahid Rezazadeh picture Vahid Rezazadeh · Sep 13, 2017

Use this code:

navigationView = (NavigationView) findViewById(R.id.navigationView); 
navigationView.bringToFront();