getDisplay() in Constructor or at startApp()

Go down

getDisplay() in Constructor or at startApp()

Post  javafan on Wed Oct 10, 2007 2:53 am

is it better to identify the display in the constructor or in the method startApp().

Code:

Code:
public class SampleMIDlet extends MIDlet {

private Display display;

protected void startApp() throws MIDletStateChangeException {
display = Display.getDisplay(this);
}

                ...

}
vs.

Code:
Code:
public class SampleMIDlet extends MIDlet {

private Display display;

public SampleMIDlet() {
display = Display.getDisplay(this);
}

                ...

}

somebody informed me, that some mobile phones are unable to execute "getDisplay" in the constructor. but most of the open source code i checked are coded in this way.

what's your style? do you know, if there can be any trouble?
avatar
javafan

Posts : 11
Join date : 2007-09-11

View user profile

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum