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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:18:04+00:00 2026-06-18T01:18:04+00:00

The is a problem that affects platforms prior to 3.0, i.e. when Sherlock acts

  • 0

The is a problem that affects platforms prior to 3.0, i.e. when Sherlock acts as a proxy to provide the action bar menu items.

I have a Fragment Activity that contains two fragments, each with its own set of options menus. When the activity starts the first fragment tab is shown and its menu items work normally. However, the first time that I switch to the other tab its menu items do not respond. If I switch back to the first tab and select the other tab again they start to fire normally.

It looks like this is a known problem. Check out the discussion here.

My workaround for now is to detect the first time that the second tab is selected and programatically switch back to the first tab. This forces the user to select the second tab again, but from that point on it works normally, as long as the user stays in that activity.

I am wondering if anyone else has found a more elegant solution to this problem. Thanks!

First fragment:

  @Override
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
      moveMenuItem   = menu.add(Flashum.MENU_GROUP_MULTI, Flashum.MOVE_FLASHES_ID, 0, R.string.move_flashes);
      cloneMenuItem  = menu.add(Flashum.MENU_GROUP_MULTI, Flashum.CLONE_FLASHES_ID, 0, R.string.clone_flashes);
      deleteMenuItem = menu.add(Flashum.MENU_GROUP_MULTI, Flashum.DELETE_FLASHES_ID, 0, R.string.delete_flashes);
      moveMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
      moveMenuItem.setIcon(R.drawable.move2red);
      cloneMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
      cloneMenuItem.setIcon(R.drawable.hard_drive_clone);
      deleteMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
      deleteMenuItem.setIcon(R.drawable.delete);
   }

Second fragment:

   @Override
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
      saveMenuItem = menu.add(Flashum.MENU_GROUP_SAVE, Flashum.SAVE_CHANGES_ID, 0, R.string.save_changes);
      saveMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
      saveMenuItem.setIcon(R.drawable.save);
      menu.setGroupVisible(Flashum.MENU_GROUP_SAVE, true);

      recMenuItem = menu.add(Flashum.MENU_GROUP_REC, Flashum.RECORD_ID, 0, R.string.record);
      recMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
      recMenuItem.setIcon(R.drawable.microphonehot);
   }
  • 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-18T01:18:05+00:00Added an answer on June 18, 2026 at 1:18 am

    Try to clear your menu before you inflate it in your fragments. So in your fragments in onCreateOptionsMenu methods call menu.clear(); at the beginning and then inflate your menu.
    Something like this:

       @Override
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    
      super.onCreateOptionsMenu(menu, inflater); 
      menu.clear();
    
      saveMenuItem = menu.add(Flashum.MENU_GROUP_SAVE, Flashum.SAVE_CHANGES_ID, 0, R.string.save_changes);
      saveMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
      saveMenuItem.setIcon(R.drawable.save);
      menu.setGroupVisible(Flashum.MENU_GROUP_SAVE, true);
    
      recMenuItem = menu.add(Flashum.MENU_GROUP_REC, Flashum.RECORD_ID, 0, R.string.record);
      recMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
      recMenuItem.setIcon(R.drawable.microphonehot);
    

    }

    Try it in both of your fragments.

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

Sidebar

Related Questions

I believe I have a very common problem that affects developers with multiple versions
The problem that I have is somehow very specific. I have to implement a
I have a problem that I'm working on for quite some time now. I
Seems to be a problem that many people have, but all the answers I
I'm facing a problem that I can summarize as it follows: I have a
I have the same problem that is listed in the following thread. WSDL first
I have a big problem that a recursive treeview doesn't update any childs if
I have a problem that I don't know how to solve. I have have
I have a strange JavaScript problem using window.location.href , which apparently only affects Firefox
I have a very strange issue that only affects webkit browsers for some reason,

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.