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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:19:16+00:00 2026-05-23T16:19:16+00:00

I am having issues with my app where it force closes when ever it

  • 0

I am having issues with my app where it force closes when ever it is interrupted by a phone call or the home key is pressed. When the user goes back to the app it they receive the force close message. I have read the following question and tried to answer suggested: Force Close when opening app after pressing home button and here: Android crash when app is closed and reopened.
The answers posed in the second question did not help and when I added wait()it gave me a force close when the app opened and when I added notify() it gave me a force closed when ever I left the app. I am out of ideas and now looking for so see if anyone might have a solution to this problem.

I am using a surfaceview with the surfaceCreated & surfaceDestroyed methods used by LunarLander.

Thanks in Advance.

LogCat:

Log1:<br>
07-08 02:18:32.284: ERROR/AndroidRuntime(627): Uncaught handler: thread main exiting due to uncaught exception
07-08 02:18:32.354: ERROR/AndroidRuntime(627): java.lang.IllegalThreadStateException: Thread already started.
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at java.lang.Thread.start(Thread.java:1322)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at com.android.hitmanassault.HitmanView.surfaceCreated(HitmanView.java:115)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at android.view.SurfaceView.updateWindow(SurfaceView.java:454)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:189)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at android.view.View.dispatchWindowVisibilityChanged(View.java:3782)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at android.view.ViewRoot.performTraversals(ViewRoot.java:706)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at android.os.Looper.loop(Looper.java:123)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at android.app.ActivityThread.main(ActivityThread.java:4363)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at java.lang.reflect.Method.invokeNative(Native Method)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at java.lang.reflect.Method.invoke(Method.java:521)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
07-08 02:18:32.354: ERROR/AndroidRuntime(627):     at dalvik.system.NativeStart.main(Native Method)

Log2:

07-08 02:21:39.805: ERROR/AndroidRuntime(663): Uncaught handler: thread main exiting due to uncaught exception
07-08 02:21:39.854: ERROR/AndroidRuntime(663): java.lang.IllegalMonitorStateException: object not locked by thread before notify()
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at java.lang.Object.notify(Native Method)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at com.android.hitmanassault.HitmanView.surfaceDestroyed(HitmanView.java:135)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at android.view.SurfaceView.reportSurfaceDestroyed(SurfaceView.java:488)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at android.view.SurfaceView.updateWindow(SurfaceView.java:413)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:189)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at android.view.View.dispatchWindowVisibilityChanged(View.java:3782)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at android.view.ViewRoot.performTraversals(ViewRoot.java:706)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at android.os.Looper.loop(Looper.java:123)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at android.app.ActivityThread.main(ActivityThread.java:4363)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at java.lang.reflect.Method.invokeNative(Native Method)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at java.lang.reflect.Method.invoke(Method.java:521)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
07-08 02:21:39.854: ERROR/AndroidRuntime(663):     at dalvik.system.NativeStart.main(Native Method)

SurfaceDestroyed Methods:

public void surfaceDestroyed(SurfaceHolder holder) {
        Log.d(TAG, "Surface is being destroyed");   
        boolean retry = true;
        thread.setRunning(false);
        thread.notify();
        while (retry) {
            try {
                thread.join();
                                //thead.notify();  ---I would get rid of the join part
                retry = false;  
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }               
        }
        Log.d(TAG, "Thread was shut down cleanly");
    }

SurfaceCreated Method:

public void surfaceCreated(SurfaceHolder holder) {
        thread.initLevel();
        thread.setRunning(true);    
        thread.start();
                //thread.notify();      
    }

EDIT:
where I have the join at tried switching with notify, wait. I also tried putting notify before the try and putting wait where join is.

  • 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-23T16:19:17+00:00Added an answer on May 23, 2026 at 4:19 pm

    An app that force-closes always produces a stack trace that can be seen in your logcat buffer. If your app force-closes, the top of the stacktrace will contain one of the classes inside your app, marking the line-number that triggered the crash.

    Investigate that line-number to see what went wrong. (For a more detailed answer, you can also provide more details by updatingg your question to include the stacktrace + code that leads up to the crash.)

    By using proper exception handling & coding, an application should rarely crash (unless the android subsystem brings down your app).

    In your case, you have several threading issues.

    You cannot start the same thread twice, and you cannot call notify before calling a wait on the thread. It’s also a good practice to call wait(), notify(), notifyAll() must in a synchronized method/block.
    (See this for more info : http://www.xyzws.com/Javafaq/why-wait-notify-notifyall-must-be-called-inside-a-synchronized-method-block/127)

    I would also suggest doing some reading on concurrency in Java : http://www.javaconcurrencyinpractice.com/

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

Sidebar

Related Questions

I have a huge web app that is having issues with memory leak in
For the last couple months i have ben having some issues with my app.config
I am having some threading issues with a large app I am working on
As usual, I'm having strange issues with deploying a Rails app to our different
Im still having issues using HttpWebRequest . For some reason sometimes in my app
I'm having issues with loading the user's information into Flash from a PHP script.
I'm having issues getting some scoping right with the below app. by the time
I'm trying to port the speakhere example into another app and I'm having issues.
I'm having issues with my webserver and iPhone app, considering the timezone. It's all
I'm having issues getting a simple server/client socket app working in C# between two

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.