How to restrict j2me application in the Landscape

2020-07-17 05:57发布

I am developing application using J2ME and LWUIT.I want to run this application on landscape mode only. For Nokia there is an attribute : Nokia-MIDlet-App-Orientation: landscape but for other device , What is the attribute to restrict the application to landscape mode only? How to achieve this for different J2ME devices?

3条回答
神经病院院长
2楼-- · 2020-07-17 06:02

I check the method Display.canForceOrientation() this give you the wrong answer because the value in the LWUITImplementation.java is hard coded and always return false. So in LWUIT if we want to restrict application the only way to do this is to add a JAD attribute through code it not possible.

查看更多
趁早两清
3楼-- · 2020-07-17 06:07

If you want to lock the screen orientation in LWUIT, you must use a combination of the following methods.

Display.isPortrait() Returns true if the device is currently in portrait mode. Display.canForceOrientation() Returns true if the device allows forcing the orientation via code, feature phones do not allow this although some include a jad property allowing for this feature. Display.lockOrientation(boolean portrait)On devices that return true for canForceOrientation() this method can lock the device orientation either to portrait or landscape mode

I hope this can help you.

查看更多
一夜七次
4楼-- · 2020-07-17 06:12

Following is the attribute to restrict application in landscape mode only.

Nokia device:

Nokia-MIDlet-App-Orientation : Landscape

Samsung device:

MIDlet-ScreenMode : Landscape
查看更多
登录 后发表回答