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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:08:54+00:00 2026-06-01T09:08:54+00:00

Hello StackOverflow Users, I am new to android and trying to develop a game

  • 0

Hello StackOverflow Users,

I am new to android and trying to develop a game in which I use a

1) Main class to redirect (like a menu.. new game, options, help, exit etc..)

2) A surfaceview class

3) A thread to handle drawing on canvas.

I have added an exit button on the main class.

However after playing the game i.e. drawing the objects and using them, when i redirect to my Main class and try to exit; the main screen disappears but the view and threads aren’t destroyed.

This is the main class.

package com.tgm.welcome;

import com.tgm.R;
import com.tgm.main.GThread;
import com.tgm.main.TGMActivity;
import com.tgm.options.OptionsMain;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

public class Welcome_Act extends Activity {

    ImageView game, exit, options;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.welcome);

        game = (ImageView) findViewById(R.id.newGame);
        options = (ImageView) findViewById(R.id.options);
        exit = (ImageView) findViewById(R.id.exit);


        game.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                gotogame();
            }
        });

        options.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
            goto_opt(); 

            }
        });


        exit.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                exit_game();
            }
        });
    }



    public void gotogame() {
        Intent game = new Intent(Welcome_Act.this, TGMActivity.class);
        startActivity(game);
    }

    public void goto_opt() {
        Intent opt = new Intent(Welcome_Act.this, OptionsMain.class);
        startActivity(opt);
    }

    public void exit_game() {

        System.exit(0);
    }

}

PLEASE HELP TO REMOVE THE GAMESCREEN FROM THE STACK THAT ANDROID MAINTAINS.

Thanks..

  • 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-01T09:08:56+00:00Added an answer on June 1, 2026 at 9:08 am

    Just call finish on the activity you want to remove from the stack.. it does the work you want..

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

Sidebar

Related Questions

Hello dear users of the stackoverflow! I really like the search form on this
Hello Stackoverflow users, I have a question regarding an JQ UI widget im trying
Hello fellow Stackoverflow users, I have a page which does a AJAX request to
Hello stackoverflow community ! I am trying to figure out how to architect my
Hello people of stackoverflow. I have a problem. I'm trying to set up my
I'm new to Android, I've followed the hello world tutorial through and have a
Hello StackOverflow, I'd like to know if there is way to trigger an event
Hello wonderful stackoverflow users. I have a question about url loading. In many browsers
Hello stackoverflow pals.I am a new rails learner. My question is: I am listing
The Quetion Hello. I'm trying to figure out the best way to use one

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.