Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 5
Registered: ‎05-10-2010
My Device: many
My Carrier: -na-
Accepted Solution

Screen rotation with virtual keyboard.

Hey all, I'm porting a non-touch app to work in touch devices, but screen rotation is throwing me some curves that I can't seem to find a good solution for. I've got an image for the background of a screen. In the paint background method of the vertical field manager that holds everything, I check the current resolution and draw the appropriate image for portrait of landscape mode. This works well, so long as the virtual keyboard is hidden. I bring up the keyboard (from, say, clicking in a text field) and the background image doesn't change (i.e. going from portrait to landscape leaves me with a white bar on the right side of the screen), and the fields have the same widths and layouts. Any advice?
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Screen rotation with virtual keyboard.

Can't comment on the keyboard appearing and disappearing, but sublayout is called in your Screen, when the Storm detects rotation, so you need to do handle the tilt.

New Contributor
Posts: 5
Registered: ‎05-10-2010
My Device: many
My Carrier: -na-

Re: Screen rotation with virtual keyboard.

Ah ha! Long story short, Display.getHeight() returns the height of the screen, but if the virtual keyboard is displayed, it's height will not be included in the getHeight() value.  This was causing problems with my orientation detection code.

 

The odd display behavior was a result of me being too careful.  I put "default" in all of my switch statements during the original non-touch development, so that when I did add different resolutions, it would display a screen that would be small, but not crash.  I failed to detect a known resolution, and continued to display portrait mode, but only while the keyboard was visible.