开发者

Force blackberry game to always use landscape mode

开发者 https://www.devze.com 2023-02-22 21:42 出处:网络
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

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

精彩评论

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