I have a basic Java problem in my app.
I'm creating a program of bouncing balls:
- I have 10 Image Views of 10 different balls.
- I have a Ball class which uses its own thread (ball's physics).
In MainActivity I create a new ball (first Image view).
balls[0] = new Ball (this,images[0])
? ? ? Everything is perfect until step 4, I can see a bouncing ball on my screen, but now I want to add the second ball and so on. I want to wait 5 seconds until my next ball appears and here I'm stuck and have thread issues.
My question is : where should I place the next command
balls[1] = new Ball (this,images[1])
;
and how can I suspend it to wait 5 seconds before it starts.
Should I create another thread in main activity and use "sleep"? and if so- it will be a thread calling a new thread (my problem)