logo       

Re: Should I do initialing work in midlet constructor?: msg#00206

java.sun.kvm

Subject: Re: Should I do initialing work in midlet constructor?

Hi,

I call Display.getDisplay() all the time from MIDlet constructors and I have
never had a problem.

I guess what they are getting at is that the method requires a MIDlet as a
parameter and the MIDlet is not yet initalalised. Its a bit like not
starting audio unti the canvas is visible.

I have never had any problems with these things as I said but I have been
focusing on Motorola and Nokia terminals.

StartApp() is called every time the MIDlet leaves the paused state as well
as the first time the MIDlet starts. The constructor is the safest place to
put such start up code. Not all KVM AMS/JAM supportthis behaviour though, so
if you find the methods are not getting called HideNotify() and ShowNotify()
are always called in the canvas. These are guatenteed to work. Basically you
move the StartApp() code to ShowNotify() in these cases.

Peter


From: Xu Feng <cyachina@xxxxxxx>
Reply-To: A mailing list for KVM discussion <KVM-INTEREST@xxxxxxxxxxxx>
To: KVM-INTEREST@xxxxxxxxxxxx
Subject: Should I do initialing work in midlet constructor?
Date: Fri, 26 Sep 2003 10:19:18 +0800

From Learning wireless Java by Qusay H.Mabmoud, I learned that I should
never call Display.getDisplay() in midlet constructors, because that may
cause errors by application manager.
But the startApp() method may be called many times, and that would consume
much time if initialing work is done in the startApp() method.

So, how should I do?

_________________________________________________________________
Sign-up for a FREE BT Broadband connection today!
http://www.msn.co.uk/specials/btbroadband

===========================================================================
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