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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:34:19+00:00 2026-06-15T19:34:19+00:00

I want to start a game from a menu. In Eclipse, I have 2

  • 0

I want to start a game from a menu. In Eclipse, I have 2 projects, one with the menu, the other the actual game. Both using SimpleBaseGameActivity as their base. The examples on the net do something like below. In particular, it creates an intent and starts an activity with that intent. The code below gives a NoClassDefFoundError on MyGame.class. This is no surprise since MyGame.class doesn’t exist, but rather MyGame.apk does. How do I do this?

public boolean onMenuItemClicked(final MenuScene pMenuScene,
        final IMenuItem pMenuItem,
        final float pMenuItemLocalX,
        final float pMenuItemLocalY) {

    switch(pMenuItem.getID()) {
        case MENU_PLAY:
        MainActivity.this.runOnUiThread(new Runnable() {
            public void run() {
                Intent intent = new Intent(getApplication(), MyGame.class);
                startActivity(intent);
                finish();       
            }
        });
        return true;
    }
}

—– edit

I’ve got it working, with everything in one project, in that when the menu item is clicked on, then the game starts. However, when the ‘back arrow’ is clicked, it doesn’t return to the menu, but rather to the operating system. The activity definitions in the manifest file are below. Does this look correct?

<activity
    android:name=".MainActivity"
    android:label="@string/title_activity_main" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

<activity
    android:name="com.mygame.MyGame"
    android:label="@string/mygame_activity"
    android:parentActivityName="com.menu.MainActivity" >
    <meta-data
        android:name="android.support.PARENT_ACTIVITY"
        android:value="com.menu.MainActivity" />
</activity>

I added this to MyGame, but it doesn’t get called:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}

— edit
I needed to remove this line:

MainActivity.this.finish();
  • 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-15T19:34:20+00:00Added an answer on June 15, 2026 at 7:34 pm

    MyGame have to be an activity and it must be mentioned in Android.manifest as an activity.

    http://developer.android.com/training/basics/firstapp/starting-activity.html

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

Sidebar

Related Questions

I want to try to implement the Tetris Game using TDD. From what I've
I want to start on a 2D game using C#, so I'm checking out
I have 3 activities. start / game / finish, I want to go start
I have written some code to start off my game, i now want to
I have a situation like this: start(); <Some code> end(); I want start() function
I want to start several threads, retrive data from net, perform some actions with
I have a usual iOS Cocos2d game. I start with a MainMenuViewController, which then
I have the following code: def show @game = $site.new_game_of_type(params[:id]) @game.start end def update_game_time
I have a memory game here. And each time a card is removed from
I want to use redis for my game's leaderboard data and I have seen

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.