Search code examples
java-meorientationmidplcdui

How to lock the landscape mode in j2me app?


I want to show my app only in portrait mode. I have to restrict the landscape mode in my app.

There are separate attributes for each devices.

For Nokia, Nokia-MIDlet-App-Orientation : Portrait. For Samsung, MIDlet-ScreenMode : Portrait.

After adding these in JAD, I tried to install it in Nokia C5. I am unable to install it. I am getting Compulsory attribute missing error because custom JAD property shouldn't start with MIDlet-. I am unable to install it because of MIDlet-ScreenMode : Portrait property.

Is there any general code to lock the landscape mode in all devices like NOKIA, LG, Motorola, Samsung etc.,


Solution

  • There is no way in MIDP to lock an app to an orientation. This is usually implemented via proprietary JAD parameters on different devices. You need to find out what these parameters are for the devices you wish to target and add them to your JAD.

    Some methods to do this are in the answer to this question.