The question is simple:
How do I catch clicks on the menu button on a class that extends from PopupWindow?
What I'm doing now is the following:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_MENU)
{
if (ab != null) {
ab.showActionOverflowMenu();
}
}
return true;
}
ab.showActionOverflowMenu() does the following:
public boolean showActionOverflowMenu() {
if (actions.size() >= 4) {
try {
if (ag.isVisible()) {
ag.dismiss();
} else {
showActionOverflow();
return true;
}
} catch (Exception e) {
showActionOverflow();
Log.d("click", "click");
return true;
}
}
return false;
}
showActionOverflow() just sets up the popupwindow and attachs it to a button.
tl;dr mode: I want the menu button to dismiss or show a popupwindow.