Codename One Introduction To Android Developers

Codename One Introduction To Android Developers


0:00:00.000,0:00:19.511
Hello, I’m Shai Almog co-founder of Codename One. I want to talk to you about how Codename One
can help you build mobile applications for Android, iPhone, iPad and other devices while
leveraging your exising skills. 0:00:21.130,0:01:61.941
First, lets talk about what Codename One is at a birds eye view. Codename One allows developers to build true
native applications. Not HTML5 or PhoneGap applications, real native
apps! We work directly on Dalvik when running on
Android but on iOS we translate the code to C and integrate it with Objective-C producing
performance that is up to 3 times faster than iOS native code! Yes, faster than native! We are also a free and open source project,
so we hope you join our community and take part in that. 0:01:63.436,0:01:73.797
So lets start with a quick demo, first of what Codename One can accomplish followed
by how you build a Codename One application. 0:01:76.032,0:01:116.993
As you can see here I have two elements on the screen, one is my physical ipad. Its mirrored through the wifi onto my Mac
and then recorded on video so any video skipping is related to that overhead. The second screen is our Codename One simulator
which we use for development. Think of it as a fast and usable version of
the Android emulator. I can rotate the simulator and access a great
deal of functionality right from here ranging from a unit test recording tool to bug tracking
tools and network monitoring tools. 0:02:122.146,0:02:146.907
As you can see we have quite a few animations we can do in this UI which work the same both
in the simulator and on the physical device. Notice that the UI arranges itself differently
when running on a tablet and on a phone, these are all trivial to accomplish! 0:02:148.396,0:02:162.957
We can change the look of the application completely and give the application a more
plain vanila look or a rich and completely controlled look such as our lether theme. 0:02:165.880,0:03:220.191
We can preview the application on a Nexus One simulator. As you can see while the basic UI looks the
same there are many small differences underneath. We automatically adapt to Androids glowing
edges instead of the iPhone’s snap behavior. Buttons look different, alignment is different
and many other things behave differently. Yet we can apply things such as the leather
theme to make everything look and act more uniformly across the different platforms. Then again we can do the exact opposite and
make everything look like native android 2. When running on a galaxy nexus everything
will have the android 4 feel with the full action bar but I’m running ahead here. 0:03:223.848,0:04:264.809
So lets see how its done, I’m using Eclipse here but this should work just as well on
NetBeans. First we can create a new hello world application
using the new application wizard, we can just pick a theme and the default application. You will notice we have several theme types
we can pick such as the native theme, or various other themes. We will pick the social boo theme. Next we can pick the default application we
want, we can create a handcoded application or go with a GUI builder application such
as the tabs app which I will pick. 0:04:269.219,0:04:284.980
We now have a newly created application in place which we can launch using Eclipse, debug
etc. We can play with the application in the simulator
just like we can in any other app. 0:04:289.385,0:05:326.446
So how is this different from Android? We don’t need a manifest, a res dir or many
of the different complexities that Android imposes. We have 3 source files, the important ones
are this main class which is effectively a simplified activity class that works for all
platforms. GUI builder applications also have the state
machine class where all of your code to connect to the GUI should reside. We can visually edit the UI by double clicking
the resource file, this opens the Codename One designer tool. 0:05:329.369,0:06:376.180
In the Codename One designer we can customize the theme, GUI, images, localization and many
other aspects of your application. Its your one stop shop for UI, multi-DPI support
and localization. The theme is as powerful as CSS in many regards
but much simpler, everything is visual and we can customize the whole thing from one
place. We have 9-piece borders which we can cut and
they would automatically generate a version for every DPI (I will talk more about this
later). We can set transitions, fonts and pretty much
everything from this one place. 0:06:379.094,0:06:417.655
We also have the GUI builder section which allows us the sort of drag and drop UI we
are used to. If you are used to layouts of views in Android
then Codename One is pretty similar. We have a container and it has a layout which
you can determine. The components then arrange themseleves based
on the layout we chose. E.g. here I picked the box layout Y which
is similar to a vertical linear layout and once I did that I can now drag elements into
place and just double click them to edit them. 0:07:422.805,0:07:451.616
The image section allows us to add multi-images which can adapt to every DPI. The cool thing about this feature is that
the tool can automatically scale the image using a high quality scaling algorithm and
adapt it for every device density. We can do it by specifying the image resolution
of the source image and we automatically get images that match every DPI. 0:07:453.107,0:07:470.218
To get a native application all we need to do is right click on the project and select
the platform we want to build on. There is a bit more to do here since we need
certificates for iOS etc. but basically this is it. 0:07:472.449,0:08:498.560
On our cloud we have Macs with xcode and Winodws machines which means you can build native
iOS applications without having a Mac or native Windows Phone apps without having a Windows
machine. You can build offline using our open source
tools but we only provide official support for this process to our enterprise developers
since supporting native build is very intensive. 0:08:500.800,0:08:512.361
We hope this short introduction has been helpful to you, please talk to us in our discussion
forum. We thank you for taking the time to watch
this.

4 thoughts on “Codename One Introduction To Android Developers

  1. would this help me if I have a simple app built for android (android java) and want to translate (or somehow make it for in) iphone?

Leave a Reply

Your email address will not be published. Required fields are marked *