|Others >> Misc|
Your screen orientation changes but does your eSWT adjust?
|Language:||English||Quality:||High||Has Audio:||true||Source:||Other||Media:||Flash||Posted On:||08 Mar 09|
The late editions to the eSWT enabled phones, such as N97 and the 5800, come with a load of features that are significant to mobile UI development. Possibly, the most significant of those features that you should consider in your UI design is the automatic screen orientation changes due to accelerometer.
eSWT implementations do their best to help with the orientation changes. For instance, S60 eSWT implementation resizes the top-level Shells when the UI orientation changes. This in turn causes the eSWT's layout managers to layout your UI for the new screen orientation. If you are using only top-level Shells and layout managers than it is very likely that your application's UI will be OK on both orientations.
However, on most occasions, your application is more sophisticated and requires adjusting. Also, it is desirable that your applications is able to take advantage of the new orientation. eSWT includes a bunch of APIs that can help you with that. Screen, which is part of the mobile package of eSWT, provides APIs and events for detecting the orientation changes as they happen. MobileDevice provides a way to get the available Screen(s) on the device.
I have created an example Midlet application that uses these APIs to take better use of the new orientation. Code is available from the Eclipse eRCP CVS. There is also a video of the example running on the S60 FP2 SDK. As you can see from the video, example application replaces the image with a bigger one and makes more text visible in the landscape orientation and restores it back.
Tags: gorkem-ercan, demo, nokia, java me, java, eSWT, SWT, Midlet, screen orientation, S60, SDK, mobile development, [SUGGEST A TAG]