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
You need to get the Menu Object from the PopupMenu before you get the item. So it'd be something like
Menu popupMenu = popup.getMenu();
if(Global.lock == true)
popupMenu.findItem(R.id.lock_message).setEnabled(false);
else
popupMenu.findItem(R.id.unlock_message).setEnabled(false);
And I'd do this before you call popup.show()