I created a popup menu. I need to hide a particular item from popup menu on condition, I tried this below code but it doesn\'t work and shows \"unexpectedly your app has
This answer may be helpful to someone,
I used below
popupMenu.getMenu().findItem(R.id.next).setVisible(true);
If you want to change the text of the menu, you can use below code,
popupMenu.getMenu().findItem(R.id.next).setTitle("After");