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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:06:19+00:00 2026-06-11T21:06:19+00:00

I have a BaseActivity class that extends Activity, in it I have @Override public

  • 0

I have a BaseActivity class that extends Activity, in it I have

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // draw menu stuff
    }

Then I have other class that extend BaseActivity, such as

HelpActivity extends Activity

I thought that according to the rules of inheritance, it would automatically inherit BaseActivty’s onCreateOptionMenu call. It doesn’t, so I’m not sure why.

But anyway, in HelpActivity I added this:

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
return super.onCreateOptionsMenu(menu);
}

and THAT didn’t work either (ie no menu was displayed on Galaxy Nexus). So I literally copied and pasted BaseActivity’s onCreateOptionsMenu call into HelpActivity, and that worked. Why is this the case?

edit:
Two notes:
When I say it’s not working, I mean: I have a Galaxy Nexus, and the Menu doesn’t even get displayed on the ActionBar (ActionBarSherlock). When it works, I get the menu, including the menu ellipsis.

Secondly:

According to the Android docs:

Tip: If your application contains multiple activities and some of them
provide the same Options Menu, consider creating an activity that
implements nothing except the onCreateOptionsMenu() and
onOptionsItemSelected() methods. Then extend this class for each
activity that should share the same Options Menu. This way, you have
to manage only one set of code for handling menu actions and each
descendant class inherits the menu behaviors.

Got this from: Re-using Options menu code

  • 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-11T21:06:20+00:00Added an answer on June 11, 2026 at 9:06 pm

    According to what you have pasted your HelpActivity is not extending BaseActivity.
    HelpActivity extends Activity

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

Sidebar

Related Questions

I have a BaseActivity which has my header: public class BaseActivity extends Activity {
I have my own base abstract class which extends Activity class. public abstract class
i have written the code like below public class SplashScreen extends BaseActivity{ public void
I currently have this code that creates 4 tabs using tabactivity: public class toknapp
Say i have com.mydomain.myappname. Is it a good idea to put my baseActivity class
Ok I have a simple main activity that just presents the user with a
I have a TabActivity that is the base Activity in my application. From the
Lets say I have a base activity with a menu, when I click on
I wish to have a single class which all of my Activity classes extend.
http://i1254.photobucket.com/albums/hh620/Mike_Mccone/menu.png I have a menu, linked above, that I would like to appear in

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.