Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Dec 2009

    How to get screen size INSIDE midlet ?

    Is it possible to get the phone's screen size inside a midlet and not from a canvas ?

    I want to do this because i set the canvas to fullscreen mode and when i call getHeight() i don't get the full height of the phone's display, i get 234 instead of 320.


  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Cheshire, UK

    Re: How to get screen size INSIDE midlet ?

    That's because you're doing this:

    height = getHeight();
    This works on some devices, not on others. On many devices, setFullScreenMode() works by posting an event into the event queue. It won't have any effect until that event is processed. Because only one event can be processed at a time, if you call setFullScreenMode() while processing one event (such as startApp() or commandAction()), then the "full screen" event cannot be processed until that method returns. Therefore, getHeight() still returns the non-full-screen height, because the resize has not yet occurred.

    Instead of calling getHeight() and getWidth(), use the sizeChanged() event to detect changes in the screen size. This will also help you if you need to detect other changes in size, such as a switch between portrait and landscape.

    If you need MIDP-1.0 compatibility, detect the size in the paint() event.


Similar Threads

  1. Screen size
    By HasithaRandika in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2009-01-14, 11:50
  2. image full screen
    By Morbidick in forum Mobile Java General
    Replies: 8
    Last Post: 2008-12-04, 04:16
  3. Problem with E90 and secondary screen
    By Tatanka.nbr1 in forum Symbian
    Replies: 5
    Last Post: 2008-06-27, 10:01
  4. Replies: 3
    Last Post: 2007-08-14, 07:55
  5. Audio Input Stream on N80
    By tkaihock in forum Symbian Media (Closed)
    Replies: 9
    Last Post: 2006-06-30, 09:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts