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

  • Home
  • SEARCH
  • 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 9158147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:10:55+00:00 2026-06-17T13:10:55+00:00

I have an app with two fragments, every fragment has a listview. When selecting

  • 0

I have an app with two fragments, every fragment has a listview. When selecting elements from the list the context menu appears automatically, I handle events an so on … so far so good, but my problem is when I change to the other fragment, the context menu keeps visible so user may get confused thinking that it is the context menu from the current visible list view.

I’ve tried calling

getActivity().closeContextMenu();

when switching between fragments but it doesn’t work.

Any suggestion will be really appreciated.

Thank you!

  • 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-17T13:10:56+00:00Added an answer on June 17, 2026 at 1:10 pm

    I’ve found a solution:

    I am using ListView.CHOICE_MODE_MULTIPLE_MODAL for multiple selection, at the MultiChoiceModeListener I save the actionmode for later use:

    public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
       // item selected
       Log.d("FilesFragment.ContextMenu", "onItemCheckedStateChanged(); position: " + position);
       actionmode = mode; // <- I save the action mode for later use
       listadapter.getItem(position).setSelected(checked);
    }
    

    Then when I detect that user wants to change to another tab-frame I call

    if (actionmode!=null){
      actionmode.finish();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that so far consists of two Activities: The Main Menu
I have an app that has a centre view with two views off to
I have an app that has two buttons – one for email & one
I have two fragments: 1st fragment consists of a large button in the middle
I have a listview which has a list of places - i have the
I have an app with two managed object contexts setup like this: Parent Context:
I have a main Activity and it has two fragments, ListFramgment and DetailFragment. In
I have an app with two activities. One of them list several values while
I have two fragments fragment A and fragment B.In both fragments Iam using asynctask
I have two app icons built-in (free and premium), is it possible to replace

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.