Question

I have developed a game but this is a serious problem I am facing. I don't have any threads in my code , but whenever I use alert

Display.setCurrent(my_alert)// my_alert has a timeout of 3000ms

then after this alert, a blank white screen appears.When the screen is pressed, then my game canvas reappears. Before setting alert, my game canvas of checkers board is set as the current display. This problems also appears after the automatic keypad lock.

This alert is vital for my game, Kindly suggest a solution.

Was it helpful?

Solution

Issues like that typically indicate missing or incorrect override of GameCanvas method showNotify():

The implementation calls showNotify() immediately prior to this Canvas being made visible on the display. Canvas subclasses may override this method to perform tasks before being shown, such as setting up animations, starting timers, etc. The default implementation of this method in class Canvas is empty.

Above method is invoked at return from Alert to prior screen. GameCanvas should somehow trigger repaint of the the screen (eg using repaint or flushGraphics methods), otherwise it will be displayed blank.

The fact that this problems also appears after the automatic keypad lock makes it even more likely that showNotify is not done right in your MIDlet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top