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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:43:56+00:00 2026-05-28T04:43:56+00:00

In my apps menu class I want a button to start an activity. This

  • 0

In my apps menu class I want a button to start an activity. This doesn’t work with the StartActivity() method becaue it’s not a subclass to Activity at all. So how should I do?

If you have read the “Beginning Android Games” you can see in the 6th chapter when he do a snake game how its shold look like when I want to start an activity.

//Daniel

  • 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-28T04:43:56+00:00Added an answer on May 28, 2026 at 4:43 am

    Either pass your context with the constructor like below or pass it into a static method:

     private Context context;
    
     public MenuClass(Context context){
         this.context = context;
     }
    
     private void someMethod(){
         // Do your stuff
         startNextActivity();
     }
    
     private void startNextActivity(){
          context.startActivity(context, OtherClass.class);
     }
    

    Static method:

     public static void startNextActivity(Context context){
          context.startActivity(context, OtherClass.class);
     }
    
     // Use
     MenuClass.startNextActivity(someContext);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building many apps for Android and wish to have a menu button
I want to offer a Pin to Start menu command when the user presses
i've seen this cool kind of menu in different apps, so i guess it
I saw in many apps this.. When you click on a menu, than an
I want to create a folder under the Start Menu using InnoSetup. On Windows
There are lots of java apps on my simulator menu screen which I have
I noticed that the sample apps from QT show their menu bar as opaque,
My apps are installed. They used to work. Now that I made some edits
Many Windows apps (like Skype or MSN for instance) don't let you start multiple
Why does the following manifest not install a widget icon on the widget menu?

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.