The moose likes Android and the fly likes java.lang.IllegalThreadStateException: Thread already started Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Mobile » Android
Reply Bookmark "java.lang.IllegalThreadStateException: Thread already started" Watch "java.lang.IllegalThreadStateException: Thread already started" New topic
Author

java.lang.IllegalThreadStateException: Thread already started

jite eghagha
Ranch Hand

Joined: Oct 06, 2006
Posts: 123
hi,

Here's what i'm doing.

From HomeActivity, using an Intent, i start MenuActivity


In MenuActivity, i create an instance of GameView, which extends SurfaceView

GameView is a video game, and so it is passed to GameLoopThread which extends Thread (GameLoopThread calls onDraw() over and over to move Sprites).

Below is the run method in GameLoopThread.



When i click on a Sprite, i start ItemActivity using an Intent

When i click on the back button on my phone i expect to exit the ItemActivity and return to the GameView g, but i get the "Thread already started error"

The error is occurs in GameView g in a SurfaceHolders Callback method.


There error causes me to ask....
How do i handle the Thread that GameView g is running in? Can i kill it?, can it sleep?, what happens to it when ItemActivity is destroyed and MenuActivity (GameView g) is brought back to the front.





 
IntelliJ Java IDE
 
subject: java.lang.IllegalThreadStateException: Thread already started
 
Threads others viewed
Socket closed exception while downloading heavy files
Dan's Thread
Moving graphic in relation to another
co-ordination between join(), start(), sleep(), interrupt()
sharing variables between classes
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com