开发者

Blackberry Force Screen orientation

I am creating an app for Blackberry. Throughout most of the time this app is used it will need to be in Display.DIRECTION_EAST orientation. But there is some setup that needs to be done the very first time this app runs. The setup involves a Dialog that pops up with a text field that needs to be filled in, and an enter button to press once you're done. In landscape mode the en开发者_开发百科ter button gets scrolled off of the screen and it is not apparent that dialog needs to be scrolled down to press enter. So for while this dialog is on the screen I want to force the device back into Display.DIRECTION_NORTH mode. Currently I am using this:

    int direction = Display.DIRECTION_NORTH;
    Ui.getUiEngineInstance().setAcceptableDirections(direction);

But my problem is this command does not actually change the orientation when its called. What it does is allow the orientation to change once you tilt the device one way or another. Is there another command I can add after this that will force it to change immediately? Or perhaps a different mechanism for setting the orientation that does so immediately instead of waiting for accelerometer change?


Instead of showing a popup box, you can call the setAcceptableDirections() code before your screen is shown.

I have seen suggestions to subclass MainScreen, and add the code into the constructor. In my experience, I prefer to add the code to the application's main() method.

My full code can be found at the answer to this related question: How to fix alignment for vertical and portrait screen in BlackBerry?


I had the same. This is (or was, at least I don't know whether they've fixed this) a known RIM issue. Check this BB support forum thread.

On '2008-12-10 09:41 PM' MSohm says there:

Currently, aApplications start in the current orientation of the BlackBerry Storm, regardless of what modes a developer has specified. Once a user tilts the device to the correct orientation, the application will change its orientation and then lock it in place.

Basically the recomendation is to show a PopupSceen that asks to tilt the device in a desired for you orientation after you called setAcceptableDirections. Once user did what you asked you hide the PopupScreen. Also you can check whether the device is properly oriented (if already OK, then just no need to show the PopupScreen).


This is the RIM response

If you had already found that, and it doesn't help you, let me know.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜