Hi,
Is it possible to disable automatic screen rotation(Accelerometer thing) in my application?
Thanks.
Hi,
Is it possible to disable automatic screen rotation(Accelerometer thing) in my application?
Thanks.
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
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.
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,
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
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.
Cheers,PHP Code:public void sizeChanged(int w, int h) {
if (w > h) {
// landscape
} else {
// portrait
}
// do stuff here like...
screenWidth = w;
screenHeight = h;
screenBuffer = Image.createImage(w, h);
updateScreenBuffer();
repaint();
// ...or whatever
}
Graham.
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