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
Visitor
Posts: 1
Registered: ‎03-23-2010
My Device: Storm 9550
My Carrier: AT&T

Need help with PhoneScreen and Orientation change

I'm developing a custom PhoneScreen for the version 5.0 API, and I'm having trouble recognizing when a user has changed the orientation fo the phone.  My basic goal is to provide some text and an image on the phone screen when a call is incoming.  I've been able to get this to work well, except when the user changes the orientation of the phone, either from landscape to portrait or vice versa.

 

The issue is that the padding offset I calculated when the call came in needs to be recalculated when the orientation changes, because the image is no longer centered on the screen after an orientation change.  Unfortunately, I'm not aware of any callbacks for changes in orientation.  Based on suggestions that I've seen in other posts to overload the sublayout method in classes that derive from MainScreen, I have attempted to overload the sublayout method my class that derives from PhoneScreen, but this method does not seem to be called when the orientation of the phone changes.  At least this doesn't seem to be consistently happening on the simulator.

 

At this point I'm at a loss of what else I can try other than something hacky like setting timers to check the orientation of the phone while a call is coming in and updating the padding accordingly if it changes.  Does anyone have any suggestions of other things that I can try?

 

Thanks in advance,

Max