> Hey
>
[quoted text clipped - 9 lines]
> public void checkKeys() {
> int keyState = getKeyStates();
what does getKeyStates do?
> System.out.println(keyState);
> if ((keyState & LEFT_PRESSED) != 0) {
how is LEFT_PRESSED defined?
> System.out.println("LEFT_PRESSED");
> }
[quoted text clipped - 3 lines]
> public void run() {
> testCanvas.flushKeys();
what is testCanvas? What does flushKeys do?
> testPause = false;
> testStop = false;
> while (true) {
> if (testStop) {
> break;
> }
unless you have a very good reason, while(true) and break; are usually
not a good idea.
while(!testStop)
{
// ...
}
> while (testPause) {
> synchronized(this) {
[quoted text clipped - 3 lines]
> catch (Exception e) {
> }
please don't drop exceptions like this. Especially not *all* exceptions,
as you are doing here.
catch(InterruptedException e)
{
// ...
}
> }
> synchronized(this) {
> try {
> wait(1);
> }
> catch(Exception e) {}
see above
> }
> }
a better, consistent indentation style will make your code much easier to
read and maintain.
> testCanvas.checkKeys();
> testCanvas.advance();
what does advance do?
> }
> }
[quoted text clipped - 3 lines]
> I did click only 1 time on LEFT_PRESSED (on emulator) and it looks
> like the loop are processing my click several times
why is there a loop anyway? How does testStop ever get set to true? In
this code snippet it doesn't.
> (getKeyStates= 4,
> 4, 0, 0): 4
[quoted text clipped - 15 lines]
> LEFT_PRESSED
> java.lang.NullPointerException
It looks like you're catching this exception somewhere, and then only
printing its name. If you use Exception:printStackTrace() you'll see the
exact line number that causes the exception. For a NullPointerException
it's very easy once you know what line throws the exception: it means one
of the objects on that line is null - most likely because it was never
instatiated.
From this code snippet there is no way to tell what is going wrong
exactly. I suggest you look at the notes above, and after correcting
them post a more complete (but short!) example - if you haven't found the
solution yourself yet.

Signature
Beware the False Authority Syndrome
Jeff - 22 Dec 2005 15:06 GMT
Thank you for the tip about Exception:printStackTrace() , it took me 5
minutes to fix this problem
Jeff
>> Hey
>>
[quoted text clipped - 120 lines]
> them post a more complete (but short!) example - if you haven't found the
> solution yourself yet.