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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:22:02+00:00 2026-05-17T21:22:02+00:00

I have a game running on android. basically, it’s structure is like lunarlander I

  • 0

I have a game running on android.

basically, it’s structure is like lunarlander

I started my activity , using the layout to start the class running.

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent">

 <my.darling.gameView
    android:layout_width="match_parent" 
    android:layout_height="match_parent"/>

</FrameLayout>

When I pressed home, i can return to my game everytime. I always shut down the thread and create a new one.

The problem occurs when I pressed BACK botton.

I think my game finished. but after 4 times of “click the game” -> “click BACK”

There comes an error -> “stopped unexpectedly”

I’ve override the function : onPause() and called finish(). But it still happens.

can anyone help me?

  • 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-17T21:22:03+00:00Added an answer on May 17, 2026 at 9:22 pm

    The problem I am facing is :

    I allocate some Bitmaps in my UIthread. System doesn’t free the memory if you press the BACK button.

    Even if the activity is destroyed, it doesn’t give back memory used by Bitmap.

    So When I tried to test my game by pressing back and forth between BACK and my game, the VM shut down due to the lack of external memory.

    The Bitmaps I decoded from resources has filled all my memory.

    The easiest way to fix it :

    protected void onPause()
    {
        super.onPause();
        System.gc();
    }
    

    since there is a bug of cleaning the memory of Bitmap in android. We manually call GC to force it to clean our Bitmaps. It’s a bug.

    or use Bitmap.recycle() if you want to free the Bitmap immediately.

    http://mobi-solutions.blogspot.com/2010/08/how-to-if-you-want-to-create-and.html

    http://code.google.com/p/android/issues/detail?id=8488

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

Sidebar

Related Questions

I run a game and the running is done by hand, I have a
I have a bit of an unusual question. I'm running an old DOS game
I have my own game engine using C++ and OpenGL, but I have models
I'm trying to write a game engine in Android, but I don't have much
Is it possible to i/o to a running process? I have multiple game servers
I have the following code: def show @game = $site.new_game_of_type(params[:id]) @game.start end def update_game_time
I have been working on an Android game for the past 6 months or
I'm working on an RPG for Android, using the LunarLander API demo. I've already
I have a game which has surfaceview and running on a thread. if I
I have an game application I have written for Windows Mobile and I want

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.