Nov 19, 2009

Help for MIDP friends

eSWT developers usually come from two different backgrounds. Those who are familiar with desktop Java GUIs especially SWT that are starting to do mobile development or seasoned MIDP developers who are looking for advanced UI features for their applications. Looking at the questions coming from the later group of developers on forums, a common theme is about how to implement something that they could do with MIDP UI with eSWT. Here is some help for two cases that are asked often.

How to fix the screen orientation to landscape or portrait? This feature is implemented on MIDP UIs using a Nokia specific Midlet Jad attribute Nokia-MIDlet-App-Orientation. eSWT does not make use of the any of the Jad attributes that are present on the MIDP platform. Instead it provides APIs that enables developers to achieve the same results. This also allows eSWT applications to be easily portable between runtimes. eSWT’s way for achieving fixed screen orientation is using the Screen API. Here is a short snippet that fixes the orientation to portrait for all available screens.
1:     Screen[] screens = MobileDevice.getMobileDevice().getScreens();
2:     for (int i = 0; i < screens.length; i++) {
3:       screens[i].setOrientation(Screen.PORTRAIT);
4:     }
A good thing to remember is some devices may actually plug new screens, for the best results it is a good idea to listen for Screen changes using the listeners from MobileDevice APIs.

How to put an eSWT application to background? On mobile platforms that support background applications MIDP developers achieve sending the application to background by removing the current Displayable. Here is an entry that explains how it is done on MIDP LCDUI. The same can be achieved for eSWT applications by setting the active Shell to minimized. Here is how.
1:         Shell activeShell = display.getActiveShell();
2:         while(activeShell != null ){
3:           activeShell.setMinimized(true);
4:           activeShell = display.getActiveShell();
5:         }
The example snippet takes into account that you may actually have more than one top-level Shell, which the second one may get active once the currently active one is minimized.

I will try to make more of similar kind of posts in the future. Please do comment if you have any suggestions for content. And of course. I continue to keep an eye on the Nokia forums and Eclipse discussion boards.
Read more →

Nov 2, 2009

What else have been keeping us busy

Nokia’s Java UIs team has been quite busy getting the eSWT port on Qt ready for the last 18 months, however what we have been working on has not been limited to eSWT port on Qt. We have been running a parallel project called OpenLCDUI. The goal of the project is to create an open source ready implementation of MIDP’s GUI toolkit (LCDUI) using eSWT.

Initially, the development is done using eSWT on Symbian while the rest of the team is getting the Qt port ready. As a result, OpenLCDUI is proven to be able to bring MIDP UI support to any platform that has eSWT. Since eSWT’s Qt port can run on any platform that Qt can the list of possible platforms is quite extensive. This implementation will be open sourced together with the rest of the S60 Java Runtime as mentioned here and will provide a cross-platform alternative to developing mobile Java UIs.

Nokia’s Java UI team also has some other interesting stuff cooking up that I will be posting about soon.

Read more →