Question

Application develop in the J2ME using LWUIT. When I port this application on the Samsung Device it create the following problem.

int h = Display.getInstance().getDisplayWidth();

It returns 388 for the Samsung GT S5250. So when I draw an image using this dimension it displays a white strip at the bottom of the screen. When I call the Form.show() it displays correctly and height is 400 so how to resolve this issue. I want to know how the Form size is calculated in LWUIT and how it takes MenuBar Height and white strip display at bottom of the screen.

Was it helpful?

Solution

I think you typed getDisplayWidth() where you meant to type getDisplayHeight().

Regardless, the problem you are seeing is due to a bug in the samsung device. LWUIT invokes the full screen mode in MIDP which hides the native title area, however that doesn't always happen immediately in some devices and thus LWUIT gets incorrect information from the devices. A refresh usually solves this and by the time LWUIT draws on the screen the size is corrected.

Generally the solution is rather simple, create generic code to create your image and if the image dimensions are inappropriate when you are about to draw to the screen then just recreate the image on the fly. This will also solve the issue of device rotation which might pose a problem too.

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