Wednesday, March 10, 2010

LWUIT On Nexus One (Android) Device

A colleague of ours just got a new Nexus One device and I just had to try LWUIT on it...
I used Thorsten's port to get started and made some minor UI tweaks using the resource editor. In the process I also added a new LWUIT feature (pure touch) to make the UI behave closer to the way it does on Android/iPhone devices (show focus only when using the keypad and hide it when not using the touch screen).

The result is in the video to your right, which I feel is pretty close to the performance/behavior of native Android applications and in some regards exceeds their capabilities (e.g. Tensile drag on Lists, Text components etc.).

The advantages of working with LWUIT on Android is identical to its advantages in JavaME, you can get fixes for LWUIT and statically link it to your application thus reducing your dependency on platform changes. This by definition makes LWUIT more resistant to platform fragmentation in Android just as it does in JavaME & BlackBerry devices (and hopefully on other devices as well).

Thursday, February 25, 2010

Latest & Greatest In The LWUIT Featured Apps Gallery

This sort of blog post is somewhat of a chore for a technical guy like myself so I tend to postpone it until the flood takes ages to clear... On the other hand, its one of the most satisfying types of posts because its about you and how you are using LWUIT in amazing and imaginative ways.

Lots of the readers of this blog don't check out the LWUIT featured apps gallery as frequently as they probably should (or ever?), so as a service to these readers here are some of the latest things LWUIT 3rd party developers have been up to. Lots of apps out there aren't in the gallery which is a shame, please take the time to submit a writeup and screenshots to lwuit at sun.com.

First up is Drum Boxw which is a pattern based drum sequencer with over 40 drum instruments to choose from. Works on most recent Nokia and Sony Ericson handsets. Edit patterns, string them together into a song, and export it as a MIDI file to play as a ringtone, or to import into a desktop music package.


I'm not a fan of Twitter in general but if I would ever set up an account it would be to use Tvider. The demo for recording and immediately twitting videos/audios directly from the mobile phone is definitely an impressive & effective demo of what Java can do today.
The application is very refined and visually appealing.



Minute Training supports classic training with weight/reps and time-based training, it provides some effective tools for monitoring your progress such as visualization graphs as pictured.


Handy Safe for mobile phones is the perfect assistant for secure and convenient data management. Keep your mind free from countless numbers and letters. Have all of your important information in one place, safe, easy to access, and always with you with Handy Safe for mobile phones. Get instant access to all of your important information wherever you go!



With the Parking Tracker you never forget where you parked your car. To save the parking position you simply press a button.Later when you want to find your car again you press another button. Then the location of the car is displayed on a map as well as your own location.With this you can find your car again - anytime, anywhere!Optionally you can also enter notes, the number of the parking lot and an alarm for the expiration of your parking tickets. The application will also help to avoid fines.The Parking Tracker: easy to use and on your smartphone wherever you go.

NearPeople, provides you with details on people in your vicinity. It scans for devices using bluetooth and provides the data about people in the area. The application is multi-lingual with support for: English, Hebrew, Arabic, Chinese, Hindi and Italian.




Itiner is a free application providing users with traveller's information on mobile phones.Thanks to the effective data compression, the application displays public transportation timetables without the need for Internet connection (off-line).Cooperating with the bus or tram tracking system in a city, it can provide information about real waiting times for a given line (on-line).



The SwiftCapture is a system that enables users to draft a set of questions on a server and then download them to a phone for data capture - including taking pictures! We support many different types of phones including Blackberry. The system is used by a number of companies in the UK/Europe including Red Bull, Krispy Kreme and GFK.



The Islamic App developed 3 applications using LWUIT and tested them in several Java ME enabled devices (touch screen or not) and on Blackberrys. AlMuathen to give muslims prayer times. AlHijri to convert Gregorian date to Hijri and vice versa. AlMoumi to display the islamic 100 names of god.


Device Magic a mobile software company developed an application that connects to the fairly widely deployed OpenMRS (Open Medical Record System) server providing tracking and management of patiend details and medical records.





SMSCrypt is a mobile phone application that allows you to send and receive encrypted text messages. Most users aren't quite aware at how insecure plain old SMS messages are, SMS crypt solves this issue by adding privacy features to these common interactions.


Longtime LWUIT developer Mike has a couple of new applications just making their way into the gallery. A Video Poker for the Instinct family it h as 4 variations of Video Poker - Jacks or Better, Double Double Bonus, Deuces Wild, and Loose Deuces
For more info: http://instinct-software.com/2010/02/video-poker/


The second application from Mike is Voice+ which is a Voice Recorder for the Instinct family of phones, for more info: http://instinct-software.com/2010/02/voice-recorder/

Thursday, February 11, 2010

HTML Component Writeup In Ofir's Blog

Ofir has written a very detailed blog post about the new HTML component in LWUIT which you should probably check directly from him. He also wrote a very cool application making use of this component to browse parties in the MWC event! You can see a video of this application in action on the right side.

The HTML component in LWUIT is one of the most sought out features in LWUIT since day one. It required tremendous amount of work from Ofir which is still ongoing and the component still has allot of work pending. However, we do want something to be 100% clear: this is not, nor will it ever be a "browser in LWUIT". Opera, Bolt and other mobile browsers are usually implemented either with a native component or with a server component. The LWUIT HTML component is designed for very specific use cases that don't necessarily require a server component. So keep your expectations in place and don't expect the HTML component to render everything you throw at it since it isn't designed with that purpose in mind.

The HTML component is an example of a trend we have for quite some time of building composite components, that is assembling a component from multiple simpler components rather than implementing a component using graphics.

Wednesday, February 10, 2010

LWUIT Running On The HTC HD2 Device

The thing that the video can't really convey is just how smooth the device feels to the touch, its fast and responds immediately just like you would expect from such a device and from LWUIT.

Wednesday, February 3, 2010

Musix To Our Ears

The Israeli operator Pelephone has been offering the Musix music service developed by TriPlay for a while now. The service is essentially an OTA "all you can eat" music store for roughly 5 USD per month, you can listen to all your music over the web or through your mobile phone and download everything to your device.
After developing the initial application with all the effort involved TriPlay in collaboration with majimob, shifted the entire application code base to LWUIT thus gaining support for practically every JavaME device available including touch support, qwerty, rotation, multi-resolutions & BlackBerry/Android device support.
There will hopefully be allot of news from TriPlay in this regard in the next few months and I hope to discuss them in the near future, I also hope to cover some of the other cool LWUIT applications we get to see here and there but its difficult to get permissions/videos etc. for everything.
The videos you can see show the English version of the application running in the simulator demonstrating the "shopping" experience as well as the playback and download (media is downloaded once and not streamed). Notice that even in the English version of the application the content is mostly in Hebrew since its targeted at the Israeli market for the most part. The second video shows the application running on the relatively old F480 Samsung touch device with some of the newer LWUIT touch related features such as the VKB, touch menus etc.
I apologize for my unstable hand during the shooting of the second video ;-)

Pelephone is inadvertently a major LWUIT innovator since most of their flagship products are based on LWUIT: Telmap Navigator (very cool new version!), emoze and now Musix.

Saturday, January 9, 2010

LWUIT Is Faster Than LCDUI For Networking (at least on Samsung)

Readers of this blog should be familiar with the drill, operator goes ape sh*t over the performance of your application on a specific device and you get called in to do a weekend session on trying to figure out WTF is wrong???

Where do you even start?

I got a similar call over this weekend where an application under evaluation at an operator just didn't perform as expected for file download on Samsung devices (although is doing quite fine for other devices). Well, obviously LWUIT had nothing to do with it since its file downloads and unrelated to UI... Right?

I tried practically everything I could think of, from thread priorities to sleeps in various strategic places... Nothing.

Then I decided to start fresh, I created a pure LCDUI test case for downloading and got a respectable 80kbps download speed. When switching the test case UI to unthemed LWUIT I got a 140kbps download speed...

I always say LWUIT is fast but this REALLY floored me! There was practically no UI involved and the issue here was download speed rather than the UI speed, what was going on???

It turns out that the Samsung devices have a different threading model, even if you assign priorities to threads the background threads do tend to grab CPU even from networking (as opposed to e.g. Sony Ericsson where a network operation can stutter the UI). This behavior resulted in unbelievable performance difference between the LCDUI and LWUIT test case, even though the test is supposed to be completely IO bound.

Armed with this knowledge I did the following in the code:
  1. Raised the priority of the network thread when its working on important downloads (when showing a blocking progress bar).
  2. Reduced repaints and animations, e.g. an animate method that returns true even when a glass pane was drawing progress on top of it.
  3. I made another animate method refresh less frequently.
These changes coupled with some minor tunings got me far better performance which I can probably improve further.

Lesson learned: LWUIT's EDT thread spends allot of time sleeping and is very highly optimized, possibly more so than some LCDUI implementations. This seems like a small thing but in some devices its more important than others.

To optimize networking on Samsung devices don't think so much about networking, think about the threads you have in the background.

Having a single thread for all your IO/Networking is a good practice when writing mobile applications (obviously a single thread separate from the EDT!). This policy which was already in place had made my life very easy when debugging and optimizing issues since there was only one place to look.

Last but not least, its very difficult to debug performance problems. Its more guesswork than anything else since devices just don't give us any proper profilers or similar tools that we might have on the desktop. They also behave differently than you would normally expect (case in point above). Currently the best advice I can give with such problems is: Isolate a test case and start growing it until you reproduce and truly understand the problem.

Saturday, January 2, 2010

Tensile Drag, Centered Lists And Faster Slide

Running ahead I often forget that not everyone monitors our SVN commits so you don't all follow the latest and greatest in LWUIT (BTW to do so just go to the project mailing lists and subscribe to the commits mailing list to receive detailed commit notifications).
Three cool new things made their way into LWUIT two of which relate to touch support. The first is tensile drag demonstrated in the video to your right, this provides the feel of reaching the edge of the screen in a more physical way. This feature is now enabled for all LWUIT widgets seamlessly.
We now also support dragging on a list which is fixed on the screen vertically or horizontally (such as a carousel), this was ridiculously hard to implement and a long standing bug in our issue tracker. Fixed lists for those of you who haven't played with them, allow a developer to place the focus in a single point (top, bottom or center) and have the list scroll without the focus moving. This feature is essential for the spinner support and also allows very elaborate cool UI's.

Last but possibly most important is the fast slide transition support, some devices are relatively slow to render elaborate graphics (e.g. fonts). S60 specifically is very slow in this regard (reasonably justified since its fonts are quit crisp), LWUIT is quite efficient in font rendering however when running a slide transition rendering these fonts for every frame often bogs down the system. LWUIT now has a "fast slide" transition within the common transitions class that slides two images of the forms rather than the actual forms. This is noticeably faster on S60 devices but is also reasonably smoother on other devices.

This feature isn't enabled by default for two major reasons, the first is its higher RAM requirements and the second is that it breaks the ability to slide translucent/rounded menus/dialogs. However, if you don't intend to use these it might be worthwhile to switch to this transition for a smoother feel.