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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:15:29+00:00 2026-06-03T14:15:29+00:00

I use a contentView gameView it extends a SurfaceView and I use a thread

  • 0

I use a contentView “gameView” it extends a SurfaceView and I use a thread to have a permanent loop to my game, my onCreate() method is

public class mainclass extends Activity {
GameView game;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    game = new GameView(this);
    setContentView(game);
}

the crash logcat is

05-09 09:35:06.378: W/dalvikvm(9664): threadid=1: thread exiting with uncaught exception (group=0x40015560)
05-09 09:35:06.388: E/AndroidRuntime(9664): FATAL EXCEPTION: main
05-09 09:35:06.388: E/AndroidRuntime(9664): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:359)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:385)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at superBill.Mbiz.Egypt.GameView.<init>(GameView.java:87)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at superBill.Mbiz.Egypt.SuperBillActivity.onCreate(SuperBillActivity.java:20)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.os.Looper.loop(Looper.java:130)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at android.app.ActivityThread.main(ActivityThread.java:3683)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at java.lang.reflect.Method.invokeNative(Native Method)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at java.lang.reflect.Method.invoke(Method.java:507)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-09 09:35:06.388: E/AndroidRuntime(9664):     at dalvik.system.NativeStart.main(Native Method)

Note: this crash happens at second time but third one is ok, fourth one crashes, five is ok and so on.

  • 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-03T14:15:31+00:00Added an answer on June 3, 2026 at 2:15 pm

    @dymmeh: My code was

    @Override
              public void surfaceDestroyed(SurfaceHolder holder) 
            {
                boolean retry = true;
                mythread.setRunning(false);
                while (retry) {
    
                       try {
                                mythread.join();
                                retry = false;
                           } catch (InterruptedException e) {
                       }
                }
         }
    

    and that what caused what you said, I replaced it with

        @Override
              public void surfaceDestroyed(SurfaceHolder holder) 
            {
                mythread.setRunning(false);
                System.exit(0);
            }
    

    now, everything is going well, thanks!

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

Sidebar

Related Questions

I have a class called Game that extends View. I have an xml called
I have problem with using dequeueReusableCellWithIdentifier method. Whenever I use this one, one cell
I have a NSWindowController with a setCurrentView method in which I use the following
use Rack::Static, :urls => ['/stylesheets', '/images'], :root => 'public' run proc { |env| [200,
Use case: Wanna insert custom annotation to fields in java class generated by JAXB
Use case: class MyTask(Task): queue = 'default_queue' def run(self): # do work Normally I
I have a problem understanding how the parameter passed to the drawInRect method is
I set a NSViewController's view as contentview of mainmenu's window,now how should i use
I am not sure which one to use? cell.contentView sometimes give me weird errors
I want to use the scroll view inside the tableviewcell. I have written the

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.