开发者

Force blackberry game to always use landscape mode

I am porting a game from j2me to blackberry. In j2me there is a way to change orientation. but I don't know how to do it in blackberry. If I am using

net.rim.device.api.ui.Ui.getUiEngineInstance().setAcceptableDirections(Display.DIREC开发者_开发问答TION_PORTRAIT);

Its giving error. Please guide me.

Thanks in advance


I think you shouldn't call the setAcceptableDirections method before you enter the event dispatcher. Here's what i did in my Screen and it works:

protected void onUiEngineAttached(boolean attached) {
    super.onUiEngineAttached(attached);
    Ui.getUiEngineInstance().setAcceptableDirections(Display.DIRECTION_PORTRAIT);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜