logo       

Re: Thanks for assistance...: msg#00254

java.sun.kvm

Subject: Re: Thanks for assistance...

Hi again Mark,

> It looks like you worked it out. The key thing to remember here is that
> setCurrent() is not a synchronous call. It is a *request* to the system
> to switch screens. That request is honored at some point in the future.

Yup, I'm older and wiser now :)

> In general, I've found that coding MIDlets as a type of state machine is
> a very effective way in coping with such timing issues. Imagine that, on
> a different emulator you may never have experienced such a timing issue,
> and your midlet could experience such failure in the field.

Yup, been trying to do that myself. I eventually found the bug to be two
bugs. The second was due to a very similar issue...

My check for end of game was as follows...

if (timeout > 3000) {
timeout = false;
midlet.winReport(calculateWinnings());
state = WAITING_FOR_GAME;
}

What I had to do was move the state change to a method of its own (in this
case, playAgain()), and call it later in the program. The game was
processing all the other key events (which were actually holding up the
timeout), meaning that a new game was called prematurely.

Thanks again,


Adrian

Adrian Hill
Software Architect
NRMi

Phone: +44 (0)1482 441142
Web: http://www.nrmi.co.uk

The information contained in this message is confidential and may be legally
privileged. The message is intended solely for the addressee(s). If you are
not the intended recipient, you are hereby notified that any use,
dissemination, or reproduction is strictly prohibited and may be unlawful.
If you are not the intended recipient, please contact the sender by return
e-mail and destroy all copies of the original message.

===========================================================================
To unsubscribe, send email to listserv@xxxxxxxxxxxx and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@xxxxxxxxxxxx and include in the body of the message "help".



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise