×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    1

    Switch resolution from 240x320 to 320x240 S40 device

    Hi,

    Does anyone know what code to use (Nokia Web Tools) to detect and switch screen resolutions from a 240x320 device to 320x240 device?

    I've tried using js and css, but it seems that the css stylesheet gets optimized and some styles that I put in get stripped out.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Posts
    115

    Re: Switch resolution from 240x320 to 320x240 S40 device

    Hey,

    S40 devices don't support display orientation switching, so you don't need to worry about runtime resolution changes.

    You can set the CSS file used by the app by detecting the screen width/height at app startup and by injecting a CSS file to the html head:

    E.g. this works:

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    	<head>
    		<title>css.test</title>
    		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />		
     		<script type="text/javascript">	
    				if (screen.width > 240) {
    					document.write('<link rel="stylesheet" href="landscape.css" type="text/css" />');
    					}
    				else {
    					document.write('<link rel="stylesheet" href="portrait.css" type="text/css" />');
    				}
    		</script>
    	</head>
    	<body >
    		hi there!
    	</body>
    </html>
    CSS files or new inline styles can't be injected or created during app runtime, but you can still dynamically apply pre-declared styles during runtime using e.g. mwl.addClass / removeClass / switchClass, etc. Documented here: http://www.developer.nokia.com/dp?ur..._API_Reference

    petro
    'petro
    @petrosoininen

  3. #3
    Registered User
    Join Date
    Dec 2004
    Posts
    23

    Re: Switch resolution from 240x320 to 320x240 S40 device

    Hi Petro,

    Can you provice a complete examples i tried above code but seems not working for me .. loaded on device and simulator both. To debug place an alert, for simulator, but shoowing screen width of my laptop

    Thanks

  4. #4
    Registered User
    Join Date
    Dec 2004
    Posts
    23

    Re: Switch resolution from 240x320 to 320x240 S40 device


Similar Threads

  1. 320X240 resolution emulator
    By revathi_srikrishna in forum Mobile Java Games
    Replies: 5
    Last Post: 2010-07-16, 06:10
  2. Replies: 3
    Last Post: 2009-09-07, 19:23
  3. Rotate Orientation 320x240 to 240x320
    By zell1983 in forum Mobile Java General
    Replies: 2
    Last Post: 2006-01-26, 14:01
  4. Crash at startup on S60 3rd edition on 240x320 resolution
    By iulian_moldovan in forum Symbian
    Replies: 1
    Last Post: 2006-01-05, 10:30

Posting Permissions

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