0

I'm using LWUIT 1.4. I want to lock the orientation for landscape. So, I used

Display.getInstance().isPortrait();

But it says can't find symbol for isPortrait()?

Can anyone tell why this method not available in LWUIT1.4?

gnat
  • 6,213
  • 108
  • 53
  • 73
selladurai
  • 6,491
  • 14
  • 56
  • 88

2 Answers2

2

First...are you importing the correct Display? Is important that you don't import the lcdui Display. Second...the correct method is lockOrientation(boolean portrait) . You must write Display.getInstace().lockOrientation(true);. I think is truevalue...try to do that.

Mun0n
  • 4,438
  • 4
  • 28
  • 46
  • 1
    Third. Weren't these features added in 1.5 ;-) – Shai Almog Apr 19 '12 at 18:05
  • I used this lines but still i'm getting orientation in NokiaN8. boolean showPortrait = Display.getInstance().isPortrait(); //Display.getInstance().lockOrientation(true); Display.getInstance().lockOrientation(showPortrait); – selladurai Apr 20 '12 at 07:50
  • Sorry, If you want to put your app in landscape mode put the value to false. This should work. From the API: lockOrientation(boolean portrait) On devices that return true for canForceOrientation() this method can lock the device orientation either to portrait or landscape mode – Mun0n Apr 20 '12 at 07:58
0

Well i have made it working by getting screen height and width .

if width is less than height just discarding it and if above allowing it

implemented same kind of scenario in Lwuit as well as Blackberry UIApplication and its working

Vijay YD
  • 514
  • 1
  • 4
  • 15