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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:25:19+00:00 2026-05-21T04:25:19+00:00

I have an activity (act2), which can be launched from act1 or act3. If

  • 0

I have an activity (act2), which can be launched from act1 or act3. If it is launched from act1, I would like for my option menu to be available, meaning when you press the menu button, it shows up. If it is launched from act3, I have nothing that needs to be in the option menu so I would like for it not to appear when you press menu. How would I go about this?

  • 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-05-21T04:25:20+00:00Added an answer on May 21, 2026 at 4:25 am

    If you are invoking act2 from act1 pass a boolean variable as true through bundle. And if you are invoking act2 from act3 pass it as false or don’t pass it at all.

    In your act2 and specially in onCreate() method catch that boolean variable. You have to be careful that if you are not passing a bundle from act3 it will throw null pointer exception in act2 while doing this operation. Now you can get a boolean variable that helps act2 to determine where it came from. [if its true than it came from act1 or from act2].

    now override onCreateOptionsMenu() method in your activity, it returns boolean. So if you pass true than the menu items will pop up when you press menu button, or no menu items will pop up if you return false. Use that boolean variable you fetched from onCreate() method, you can simply return it so when its true[from act1] menu will be shown or in case of false[from act3] it will not be shown at all.

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

Sidebar

Related Questions

I have activity which can show overlay. This overlay have markers which gets from
I have an activity that launches another activity with startActivityForResult method. I would like
I have started Activity for result, but how to return string like parameter from
Sorry for my bad English. I have two activity. called Act1 and Act2 Act2
I have an activity which extends PreferenceActivity. I'm loading preferences from the xml file.
I have three activities, lets call them Act1, Act2 and Act3. There is a
I have an activity with a WebView . I would like to give the
I have an activity which shows some List entries. When I click on a
I have the following problem: I have an Activity where a user can start
I Have activity that get some data from the internet, and shows it to

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.