logo       

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

java.sun.kvm

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

Xu Feng wrote:
> 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?


For example, you could perform the time consuming tasks only if startApp
was called for the first time...

Display display;

public void startApp() {
if (display == null) { // not initialized?
display = Display.getDisplay();
// further one-time initialization steps..
}

// show midlet as requested
}

Cheers,
Stefan

---
http://www.kobjects.org

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