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 8948025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:54:05+00:00 2026-06-15T12:54:05+00:00

I want have a menu for each group in my ExpandableList when long clicking

  • 0

I want have a menu for each group in my ExpandableList when long clicking on it. But at the moment only the non-empty groups show a blue background when longclicking and are selectable. All empty groups don’t react to a long click.

I register the list to the fragment with registerForContextMenu(list) and wrote following code:

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.item_task_long_click_menu, menu);
}

@Override
public boolean onContextItemSelected( android.view.MenuItem item) {
    ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) item.getMenuInfo();

    switch(item.getItemId()) {
        case R.id.itlcm_menu_edit:
            //do something
            break;  
        case R.id.itlcm_menu_remove:
            //do something
            break;
    }
    return true;
}

In the adapter I set:

@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
    return false;
}

Why are the empty groups not selectable? Haven’t found a method to change that…

EDIT: I guess it’s the

registerForContextMenu(list)

maybe the groups without any children are not registered to the long click….

Anybody?

  • 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-15T12:54:06+00:00Added an answer on June 15, 2026 at 12:54 pm

    I was able to solve it.

    The problem wasn’t at the registerForContextMenu(). The issue was my custom ExpandableListAdapter where I used two diffrent views for the GroupViews (getGroup(…)). The one that didn’t react to any clicking at all contained a CheckBox which override the focus of the whole GroupView. So I added:

    android:focusable="false" 
    

    to the CheckBox in the XML and voila, the GroupView with the CheckBox reacted to the clicks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a menu bar and I want to create a div for each
I have a menu that changes and I want to show content in the
I have this menu structure: http://jsfiddle.net/Rochefort/szL2C/ everything is ok. But i want, hover effect
I have a ListActivity and I want to implement context menu for each of
I want to refresh the option menu each time it is called, I have
I have a menu (vertical menu) and i want each of the Ul's to
I have a menu built with <ul> and <li> tags. I want to have
I have a menu-bar and a tabbed pane in a frame, and i want
i have a menu contains of one item (item to exit application), i want
I have a menu with button objects in As3. I want to display the

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.