Nitin
Nitin

Reputation: 1986

how to use multiple threads to draw multiple bitmaps on the canvas in surfaceview?

I am developing a game in which I have to show multiple image moving in directions but one image cannot over lap other how can i achieve this. I think I should use multiple threads one thread for every image but when i try to initialize thread by sending it canvas using canvas it gives

error 01-11 17:18:15.409: E/AndroidRuntime(1046): java.lang.IllegalThreadStateException: Thread already started.

How can I achive this. Can any body give me idea or some tutorial. Any help will be appreciable.

Upvotes: 0

Views: 1145

Answers (1)

WarrenFaith
WarrenFaith

Reputation: 57672

Your error happens when you try to start an already started thread. You don't need to have multiple threads. One thread for all your drawing is more than enough.

I have written a tutorial series for introduction into android 2d drawing. I recommend you to start with the second part that introduce the thread usage.

Upvotes: 1

Related Questions