Mobile Applications and Games development
Would you like to react to this message? Create an account in a few clicks or log in to continue.

getDisplay() in Constructor or at startApp()

Go down

getDisplay() in Constructor or at startApp() Empty getDisplay() in Constructor or at startApp()

Post  javafan 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?
javafan
javafan

Posts : 11
Join date : 2007-09-11

Back to top Go down

Back to top


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