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

The Archive Base Latest Questions

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

Activity GameActivity : The page that’s opened when the application is first opened. Activity

  • 0

Activity GameActivity: The page that’s opened when the application is first opened.
Activity GameMain: The playing activity of the game.
Activity GameWin: Transfers to the next GameActivity (eventually will have a “You win!” screen, with stats and things)

  1. Application is started
  2. This is triggered:

    button = (Button) findViewById(R.id.button1);
    
    button.setOnClickListener(new OnClickListener() {
    
        public void onClick(View arg0) {
            Intent intent = new Intent(context, GameMain.class);
            intent.putExtra("level",1);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
            finish();
        }
    
    });
    
  3. GameMain has now loaded. The character, circle, is now on the left side of the screen.

  4. When circle gets to the right side of the screen, this if statement inside my game loop now becomes true:

        if ((circle.x+width/2 > end.startx) && (circle.x-width/2 < end.stopx) && (circle.y+circle.size==end.starty-width/2)) {
                layout.removeAllViews();    
                Intent intent = new Intent(context, GameWin.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                intent.putExtra("level",level);
                finish();
                startActivity(intent);
        }
    
  5. GameWin screen does this:

        Log.v(TAG,"Goint to level: "+(level+1));
        Intent intent = new Intent(context, GameMain.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.putExtra("level",(level+1));
        startActivity(intent);
        finish();
    
  6. Sometimes it works, and goes to GameMain with level data as 2, just considerably slower than if I went through the level screen and straight to level2. Sometimes it works, and goes to GameMain with level data as 2, and reloads the page over and over and over again. Sometimes, my phone restarts.

  7. If I have the ability to complete level 2, I do so. Level 3 is even slower if it works, or refreshes, or restarts the phone.

  8. If I click “Home” at any time, it goes to my home screen but the application opens itself back to the GameMain with the last level (back to step 6 or 7).

What am I doing wrong?

API Level 8, LG P500 (2.3.3)

It turns out this wasn’t the problem. The game loop was still running in the background.

  • 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-06T19:15:14+00:00Added an answer on June 6, 2026 at 7:15 pm

    It turns out it was only partially the issue of the intent; the main issue was that I wasn’t stopping the gameloop.

    When the gameloop stopped, everything worked fine.

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

Sidebar

Related Questions

I’m writing an application (game) where I would like to end the game activity
I have a simple game activity. I start it and than press the back
My Activity creates an AsyncTask that loads data from a file and updates the
My application has one activity which starts two services but does not bind them.
My activity has a simple menuItem that start a counter... the counter is stored
Problem: Activity A is a ListView that contains a ListAdapter , and clicking in
An Activity may inflate an arbitrary layout xml that may or may not have
I'm writing an android application using eclipse. I have a main activity called MenuActivity
Activity that is sending the putExtra() @Override protected void onListItemClick(ListView l, View v, int
I'm trying to create an endgame activity for my Hangman game for android and

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.