Tuesday, January 31, 2012

Building Hello World With Codename One


Here is a quick tutorial for building/debugging a hello world application using Codename One that works on all devices.


We start by creating a new project in NetBeans and selecting the Codename One project.
It is important to use proper package names for the project since platforms such as iOS & Android rely on these names for future updates.

 

By default this project is a GUI builder project so we open the Codename One Designer with the content of this file.
  

The default Codename One theme, derives from the platform native theme. We can easily change the "base theme" in the preview to see how the theme will act in different devices by clicking the native theme option in the application menu.

 

Now we can edit the generated GUI and makes changes to the screens within the GUI builder. We can bind an action event to the button and go to the code to show a dialog.

 

Now we can edit the generated GUI and makes changes to the screens within the GUI builder. We can bind an action event to the button and go to the code to show a dialog. Just insert the code:
Dialog.show("Hello", "Hi There", "OK", null);

 

Now lets send a device build for a platform this is pretty trivial to accomplish by right clicking the project and selecting the device.

 

In the build server we can now see the progress of the build and the results for the build sent. We can email a link to the deployment files, download them or even use a QR reader to install them to the phone. We intend to offer a feature that pushes builds directly to development devices soon. 

0 comments:

Post a Comment