• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.IllegalThreadStateException: Thread already started

 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.





 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!