-1

So I recently discovered Codename One and was intrigued by the fact that it uses Java for developing cross-platform mobile apps.

I was thinking if it is better or worse than the default languages that mobile platforms use.

Does it have more or less or the same capabilities as the default languages have? Can it do everything that can be done on the default Android Java? What's its difference from the defaults as well as its pros and cons?

esfox
  • 175
  • 3
  • 11

2 Answers2

0

Codename One can't do something that isn't available on the device like take a 3d picture on a 2d device.

In terms of offering programmer convenience that isn't available on the device you could use things like Java 8 language features on Android even when those weren't available on Android. You can use Java and have a GC on iOS, you can have threads when running on top of JavaScript so yes it does bring things to the table that aren't available in the native OS.

You don't get access to Androids features by default, you can access every feature of Android thru native interfaces but then you can't use that feature when building for iOS, Windows, JavaScript or other platforms.

So Codename One imposes "soft restrictions" you can get around them but you probably shouldn't do that often.

I suggest reading How does Codename One work?

Community
  • 1
  • 1
Shai Almog
  • 51,749
  • 5
  • 35
  • 65
0

A large number of features common to most devices can be implemented through CN1's API, so you just write the code one time and then build it for whatever device. You can do the same thing for the GUI, or you can customize it for each platform.

There are still a number of features not directly exposed in the CN1 API. You can create a native interface for those that becomes a connecting path from your main device-agnostic CN1 program to platform-specific classes that you write in the native platform code. It works like any Java interface so you just write native code for each method you need for each language (Objective C, C#, Dalvik, etc).

In addition, you can create a CN1LIB that is basically a native interface and the native classes that get compiled together into a JAR that CN1 will use as if it were an included API, so you get the auto code completion and other nice IDE features.

James H
  • 1,116
  • 1
  • 6
  • 11