Show popup menu on `ActionBar` item click
I have an ActionBar with an action item on it. After clicking on the action item, I want to show a popup menu. I implemented this method, but I want to anchor it to the action item or to the ActionBar , not to any view from layout. How to get some kind of view to anchor it from MenuItem ? public boolean onOptionsItemSelected(MenuItem item) { PopupMenu popupMenu = new PopupMenu(this, ??????); // What view goes here? popupMenu.inflate(R.menu.counters_overflow); popupMenu.show(); // ... return true; } So finally I found solution. When you want to anchor popupmenu to ActionItem in ActionBar you