Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor Unit1ed's Avatar
    Join Date
    Dec 2008
    Posts
    106
    Hi,

    Is it possible to disable automatic screen rotation(Accelerometer thing) in my application?

    Thanks.

  2. #2
    Nokia Developer Expert rdrincon's Avatar
    Join Date
    May 2007
    Location
    Mexico D.F
    Posts
    351
    Only in S60 5ed with the following system property



    prop: Nokia-MIDlet-App-Orientation
    platform: 5th Edition
    description: Allows MIDlet to force either portrait or landscape UI orientation. The orientation is only fixed on devices that support the specific layout.
    values: portrait or landscape
    :Ruben

  3. #3
    Regular Contributor Unit1ed's Avatar
    Join Date
    Dec 2008
    Posts
    106
    Quote Originally Posted by rdrincon View Post
    Only in S60 5ed with the following system property
    Thanks.
    Does anyone know a good way to handle screen rotation event then? I mean if it is possible somehow to update screen only once, not two times. When I rotate it, I see a square (240x240) with my previous canvas and a blank gap on the right side (80x240) and in next second it goes to the actual canvas (320x240) the user is supposed to see. Sorry, it may sound a bit stupid, but I am new to canvas/gamecanvas thing.

  4. #4
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hi rdrincon,
    please make this more clearer...please.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Regular Contributor Unit1ed's Avatar
    Join Date
    Dec 2008
    Posts
    106
    Quote Originally Posted by raj_J2ME View Post
    Hi rdrincon,
    please make this more clearer...please.
    You use this string in your JAD with portrait/landscape parameter.
    http://discussion.forum.nokia.com/fo...d.php?t=154201
    http://www.forum.nokia.com/document/...E4A538FB8.html

  6. #6
    Super Contributor grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    Quote Originally Posted by Unit1ed View Post
    Thanks.
    Does anyone know a good way to handle screen rotation event then?
    When the dimensions of the Canvas change, it will receive a sizeChanged() event. This occurs:

    * After a call to setFullScreenMode() (not immediately after).

    * After a screen rotation.

    This is the best place to pick up the size of the screen (better than calls to getWidth() and getHeight()).

    There is no specific "I am in portrait/landscape mode" information but, obviously, if the width is greater than the height, the device is in landscape, etc.

    PHP Code:
    public void sizeChanged(int wint h) {
        if (
    h) {
            
    // landscape
        
    } else {
            
    // portrait
        
    }

        
    // do stuff here like...
        
    screenWidth w;
        
    screenHeight h;
        
    screenBuffer Image.createImage(wh);
        
    updateScreenBuffer();
        
    repaint();
        
    // ...or whatever

    Cheers,
    Graham.

  7. #7
    Nokia Developer Expert rdrincon's Avatar
    Join Date
    May 2007
    Location
    Mexico D.F
    Posts
    351
    Thanks raj, you are right I didnt provide enough information.

    To sum up:

    To dissable automatic portrait/landscape switching in S60 5ed (that means forcing the app to be only landscape or portrait) you need to add to the jad file the following user defined property:


    Code:
    Nokia-MIDlet-App-Orientation:portrait 
    
    or 
    
    Nokia-MIDlet-App-Orientation:landscape

    In S60 3ed there's no way to do this, so the best way is to identify when the screen has been switched and repaint accordingly as described in the above post.
    :Ruben

Similar Threads

  1. How to disable automatic screen rotation?
    By mstream in forum Symbian User Interface
    Replies: 4
    Last Post: 2009-01-12, 04:14
  2. How to handle screen rotation? (N93)
    By JOM in forum Python
    Replies: 2
    Last Post: 2008-01-10, 09:44
  3. screen rotation problem
    By davidmaxwaterman in forum Symbian C++
    Replies: 0
    Last Post: 2007-10-12, 06:29
  4. Emulator screen size configuration and rotation
    By greatape in forum Symbian C++
    Replies: 0
    Last Post: 2006-03-01, 11:25
  5. More on Building screen rotation software
    By davidmiron in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2002-10-07, 22:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved