Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8001053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:59:11+00:00 2026-06-04T15:59:11+00:00

The question is simple: How do I catch clicks on the menu button on

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:59:13+00:00Added an answer on June 4, 2026 at 3:59 pm

    You can’t catch menu events in PopupWindow and its extendents.

    However you can catch the menu event in the Activity which launches the popupwindow
    and then dispatch it to the popupwindow.

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event)
    {
        if (keyCode == KeyEvent.KEYCODE_MENU)
        {
            yourPopupWindow.menuClicked();
        }
    
        return super.onKeyDown(keyCode, event);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question here: is there any way to convert from a jagged array to
Very simple question, I made the following program : #include <stdlib.h> int main(int argc,
The following code is pretty self-explanatory and my question is very simple : Why
Simple question, I'm writting a program that needs to open huge image files (8kx8k)
I have a simple question about sending a file (XML file) from my webapp
This is a pretty simple question, and it's blatantly my own newb status that's
I have a simple question, how can I stop timer? Button bCancel = (Button)findViewById(R.id.bt1);
My question is simple. I'm trying to make a set of java.net.URL s that
Simple question, I believe --> It is my understanding that an imaginary IEnumerator object
Pretty simple question this time around. I have an application that communicates with another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.