Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

(Difference between revisions)

Cross-platform development for Nokia X & Asha

From Wiki
Jump to: navigation, search
shai.i (Talk | contribs)
(Shai.i -)
shai.i (Talk | contribs)
(Shai.i -)
Line 1: Line 1:
[[Category:Nokia Asha]][[Category:Nokia X]][[Category:How To]][[Category:Tutorial]]
[[Category:Nokia Asha]][[Category:Nokia X]][[Category:How To]][[Category:Tutorial]]
<br />
{{Abstract|This article talks about cross-platform development for Nokia X & Asha from the point of view of current Asha lwuit developers.}}
{{Abstract|This article talks about cross-platform development for Nokia X & Asha from the point of view of current Asha lwuit developers.}}
{{Note|This is an entry in the [[Nokia X Wiki Challenge 2014Q1]]}}
{{Note|This is an entry in the [[Nokia X Wiki Challenge 2014Q1]]}}

Revision as of 16:04, 14 April 2014

This article talks about cross-platform development for Nokia X & Asha from the point of view of current Asha lwuit developers.

Note.pngNote: This is an entry in the Nokia X Wiki Challenge 2014Q1

Article Metadata
Tested with
SDK: Nokia Asha sdk 1.1, Nokia X SDK
Devices(s): Nokia Asha 501, Nokia X
Nokia Asha
Dependencies: Codenameone
Created: shai.i (14 Apr 2014)
Last edited: shai.i (14 Apr 2014)



If you previously developed apps for Nokia Asha/Series40 devices than you are probably familiar with LWUIT as it is one of the main platforms for building apps for Asha/Series40 devices with its rich UI & customizable wealth of components.
In this article i will introduce you to codenameone development platform which will help you to use your existing lwuit skills & know-how to cross-develop for Nokia X & Nokia Asha. Codenameone is open sourced and developed by the people who initially developed LWUIT who i know both in person and i must say they are both great developers.
As for me i often find myself using Codenameone for various apps or even games (even though the platform was never intended for games it is do-able) on my Nokia store publisher page you can find various apps developed with Codenameone that were build for Nokia Asha such as Snowman builder or even partly static games such as TicTacToe and my latest highly dynamic high fps game FlapFlap also note that all the mentioned above apps are also currently published to Nokia X so you can be sure its a viable option to develop and publish with it.

Note.pngNote: The links to Nokia X content currently cannot be viewed via desktop, the urls for the above 3 apps are:


The first thing you need to know when transitioning your apps from lwuit code to codenameone code is that the package names have been re-arranged and also changed so what was previously com.sun.lwuit.* is now com.codename1.ui.*
import com.sun.lwuit.Display; ===> import com.codename1.ui.Display;
import com.sun.lwuit.Form; ===> import com.codename1.ui.Form;

Resource file

If you wish to port an existing application from lwuit to codenameone and want to use your existing .res file then you should know that the lwuit .res file is of a much older file version specification and not supported in codenameone however you can try to import its content using the import feature in the codenameone resource editor (which is like the lwuit resource editor) by simply selecting your old .res file. Cn1 import feature.png

Note.pngNote: Another nice side benefit from transition to the new .res file format is that it can also be in XML which help you work on the file in team easily

Specific Asha components

Nokia specific version of LWUIT has some components and features that were unique to its Asha platform such as HeaderBar, TimePicker, ContextMenu, etc.
While you wont be able to use these specific components you could use either their codenameone replacements such as the InfiniteProgress, DateTimeSpinner, PopupDialog, etc. or try and build your own component.
Other than the Nokia custom components most of the other components exists in both platforms such as Labels, Buttons, Forms, Dialogs, Checkbox, etc.

The build process

When you used the lwuit platform the entire build process was done locally on your PC, however in Codenameone in order to build the final binary (APK for Nokia X or Jar & Jad for Nokia Asha) you have to send the build to run on the codenameone cloud servers.
Once you send the build you can view its progress and its failed/succeed status in the codenameone server page Before sending a build i suggest you test it thoroughly on codenameone emulator to avoid wasting time waiting for the server to finish building its queue.

Note.pngNote: Also each build you send to the server cost you 1 credit, however as a free user you have 100 credits per month which should be enough


While Codenameone can be used to develop for other platforms as well i mainly focused on Nokia X & Nokia Asha in this article because of the initial thought of LWUIT developers and utilizing their existing code-base.

99 page views in the last 30 days.