This is a bug only found on Motorola's J2ME implementation.
{{{Canvas.getWidth}}} and {{{Canvas.getHeight}}} only report the correct
screen size after the first screen has been shown. Code will get the wrong
size if it checks when setting up the first screen.
The J4ME {{{DeviceScreen}}} class should detect and hide this problem.
That will make Motorola phones behave consistently with other phones.
The work around is to lazily get the first screen's size. Instead of doing
it in the constructor get it in the {{{paint}}} method. After showing the
screen immediately call its {{{repaint}}} method.
'''What steps will reproduce the problem?'''
1. Call {{{DeviceScreen.getScreenWidth()}}} or
{{{DeviceScreen.getScreenHeight()}}} in a constructor for the application's
first screen
2. Override that class's {{{paint()}}} to draw a red square over that area
3. Display that screen from the MIDlet
'''What is the expected output? What do you see instead?'''
The entire screen should be red but only part of it is.
Original issue reported on code.google.com by deanbro...@gmail.com on 24 Nov 2007 at 1:29
Original issue reported on code.google.com by
deanbro...@gmail.com
on 24 Nov 2007 at 1:29