I've been following below tutorial on how to create a calendar widget in Java ME. I can't seem to get it to work.
When I run the application it just says it's running in the background. I guess I'm not initializing it properly. Where exactly to put the code located at the bottom of the page to make it display to the java phone screen?
The link to the tutorial is here apart from a few minor variable name differences the code is identical.
http://www.developer.nokia.com/Community/Wiki/Building_a_Java_ME_Canvas_based_calendar/date_picker
...it just says it's running in the background. I guess I'm not initializing it properly.
Without seeing your code it's hard to tell for sure but assuming that you did not introduce errors copying tutorial code, the most likely reason for the behavior like you describe is that you didn't invoke Display.setCurrent. This would indeed qualify as not initializing it properly.
In the class that extends MIDlet, make sure that startApp
invokes setCurrent
, like as below:
public void startApp() {
Display.getDisplay(this).setCurrent(
new CalendarCanvas(this));
}
Note in code snippet above, CalendarCanvas
is assumed to be as per tutorial you refer to:
- CalendarCanvas.java: sample usage of CalendarWidget within a Canvas...