Sunday, April 11, 2010

Back On The Touch

I always liked the aesthetics of the iPhone back behavior, placing the back button as a small arrow within the title bar is a stroke of UI design genius. I don't share Apple's disdain for physical buttons so I'm much more in favor of a physical back button, however having that button in the title area is both handy and none intrusive.

Often people ask us to customize the title area for things other than Labels, normally when a use case is so common we comply even when it goes against our core aesthetics of UI design. However, this is a special case where making such a change would break the simplicity of customization to everyone else involved.

However, in the spirit of LWUIT for making everything reasonably easy to accomplish even these iPhone like back buttons are very possible and easy to accomplish. There are two challenges involved: the shape of the button and its position in the title.

The shape of the button is solved by creating an image border with the proper shape and updating the theme, I won't publish the resource file since the images here aren't owned by myself.

Placing the button in the title of the UI Demo requires the following change to the Demo.java class in the UI Demo. In the run() method change the demo form creation to this:
final Form demoForm = new BackTitleForm(backCommand);

And add the BackTitleForm as an inner class (pasted bellow). Back title form is a simple form extension that essentially creates a content pane within the content pane and creates an alternate title component that can be anything.

    class BackTitleForm extends Form {
private Container contentPane = new Container();
private Container title = new Container(new BoxLayout(BoxLayout.X_AXIS));

public BackTitleForm(Command backCommand) {
super.getContentPane().setLayout(new BorderLayout());
super.getContentPane().addComponent(BorderLayout.CENTER, contentPane);
super.getContentPane().addComponent(BorderLayout.NORTH, title);
Label titleLabel = new Label(getName());
title.getStyle().setPadding(0, 0, 0, 0);
title.getStyle().setMargin(0, 0, 0, 0);
titleLabel.getStyle().setPadding(0, 0, 0, 0);
titleLabel.getStyle().setMargin(0, 0, 40, 0);
titleLabel.getStyle().setBgTransparency(0);
title.setUIID("Title");
Button backButton = new Button(backCommand);
backButton.setUIID("BackButton");
backButton.setPreferredH(42);
title.addComponent(backButton);
title.addComponent(titleLabel);
}

public Container getContentPane() {
return contentPane;
}

/**
* Removes all Components from the Content Pane
*/

public void removeAll() {
contentPane.removeAll();
}


/**
* @inheritDoc
*/

public void setLayout(Layout layout) {
contentPane.setLayout(layout);
}

/**
* Adds Component to the Form's Content Pane
*
* @param cmp the added param
*/

public void addComponent(Component cmp) {
contentPane.addComponent(cmp);
}

/**
* @inheritDoc
*/

public void addComponent(Object constraints, Component cmp) {
contentPane.addComponent(constraints, cmp);
}

/**
* @inheritDoc
*/

public void addComponent(int index, Object constraints, Component cmp) {
contentPane.addComponent(index, constraints, cmp);
}

/**
* Adds Component to the Form's Content Pane
*
* @param cmp the added param
*/

public void addComponent(int index, Component cmp) {
contentPane.addComponent(index, cmp);
}

/**
* @inheritDoc
*/

public void replace(Component current, Component next, Transition t) {
contentPane.replace(current, next, t);
}

/**
* @inheritDoc
*/

public void replaceAndWait(Component current, Component next, Transition t) {
contentPane.replaceAndWait(current, next, t);
}

/**
* Removes a component from the Form's Content Pane
*
* @param cmp the component to be removed
*/

public void removeComponent(Component cmp) {
contentPane.removeComponent(cmp);
}
}

Sunday, April 4, 2010

Biswajit Sarkar Talking About J2ME & LWUIT

With the current holidays around here and quite a bit of work I didn't keep up the blog as I probably should. I'll try to get back into posting soon when everything calms down around here. While waiting for me to get my act together here is a talk that Biswajit Sarkar (author of the LWUIT 1.1 book) gave at the IndicThreads conference in India.
This talk is mostly for introduction to J2ME development and covers LWUIT among many of the subjects mentioned.
Its probably too introductory level for most of the readers of this blog, however it might be very useful to pass along to colleagues as a means of introducing them to J2ME/LWUIT. Biswajit is as usual very thorough in his details which is always important when discussing something as elaborate as mobile development.

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.