deanbrowne / j4me

Automatically exported from code.google.com/p/j4me
1 stars 1 forks source link

Motorola phones report the wrong screen size before a screen has been displayed #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

Original comment by deanbro...@gmail.com on 12 Dec 2007 at 7:19

GoogleCodeExporter commented 9 years ago

Original comment by deanbro...@gmail.com on 13 Dec 2007 at 12:57