Hi,
I am writing an application to get a grip of basic sprite animation. I
have a surfaceCreated method which looks like this:
public void surfaceCreated(SurfaceHolder holder) {
mPacManThread.setRunning(true);
mPacManThread.start();
//this thread will wait for 10 seconds, and then kill the
mPacManThread thread
try {
Thread.sleep(10000);
mPacManThread.setRunning(false);
Log.d("THREAD STOPPED","The animation thread has been
stopped, as
10 seconds has elapsed.");
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
The intention is to start the thread which manages the user input and
animation, and make the main thread (that is the thread that started
the view) sleep for 10 seconds, before stopping the animation loop.
My understanding is that the Thread.sleep(10000) will sleep the thread
from which the request originated (ie the main thread) for 10 seconds.
However, it looks like the Thread.sleep() is actually working on the
animation (mPacManThread) instead. Am I missing something fundamental
here?
Thanks,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---