Anderson Nunes da Silva Anderson Nunes da Silva - 1 year ago 243
Android Question

How to listen to long click on a navigationview item?

I'm developing an android app using design library and appCompat library. I'm facing some issues when tried to listen to long click on a menu item.
My app has a NavigationView as a side menu, inside this navigationview I had a menu with a lot of items.
I can listen to click of these items but I can't listen to the long click.
Does anybody know how do I implement it?


Answer Source


You can use:

Menu myMenu = navigationView.getMenu();
MenuItem myItem = myMenu.findItem(;

myItem.setOnLongClickListener(new View.OnLongClickListener() {
     public boolean onLongClick(View v) {
       // do something 

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download