Latest posts from Codename One.
Blog

Microbenchmarks
Microbenchmarks are often derided in the Java community with some good reason, they show edge cases that either present the JIT in a bad light or show it as ridiculously (unrealistically) fast. However, with static compilers and translation tools microbenchmarks can give us insight into performance problems that normal profilers might not provide insight into. We’ve been tracking performance issues with the new iOS VM for the past couple of weeks and had a very hard time pinpointing the issues, finally thanks to microbenchmarks we see some of the performance issues and already eliminated quite a few bottlenecks in the code that bring the optimization level closer to native speed. E.g. our getter/setters are now practically free. ...

Intercepting URL's On iOS & Android
** Notice: ** the original version of this post incorrectly specified the property as AppArgs instead of AppArg. This is now fixed. For Android you would probably also want to add the build argument android.xactivity=android:exported="false". A common trick in mobile application development, is communication between two unrelated applications. In Android we have intents which are pretty elaborate and can be used via Display.execute, however what if you would like to expose the functionality of your application to a different application running on the device. This would allow that application to launch your application. ...

Can Execute
Runtime.exec is pretty familiar to Java developers (and the process builder in later versions), however for mobile applications we usually don’t have access to an executable. The solution is to invoke a URL which is bound to a particular application, this works rather well assuming the application is installed and you can activate quite a few things e.g. this is a partial list of URL’s that work on iOS . (notice that a lot of these are redundant since we have builtin portable functionality to address those features). ...

Developer Promotion – practical guide & statistics about the Java ecosystem
Before we launched our recent promotion for JavaOne tickets with Java Code Geeks we sought out guides/tutorials about running such a promotion, unfortunately we didn’t find anything useful so we had to improvise and work by instinct. This post will also cover some of the statistical results about the Java community so if this is the reason you are reading this post skip down for some interesting takeaways. ...

Perspective Transform
Over the weekend Steve posted a really cool demo showing off some of his work on the new iOS graphics pipeline, specifically the perspective transform. Perspective transform allows us to rotate elements in a 3 dimensional space to create pretty nifty effects. Right now this is only supported on iOS devices (since Java SE doesn’t really support it, only thru FX) we are still looking into the Android implementation ...

Same Size & Back Swipe
Codename One inherited basic layout concepts from Swing which in turn inherited them from AWT. We modernized and adapted them quite a bit by removing various behaviors and adding others, but a key to sizing and placing components is the preferred size. Every component calculates its own preferred size in the calcPreferredSize() method. This calculation takes into account the font, icon, padding and theme to produce the space required by the given component but sometimes that’s not good enough. ...

Codename One & Java Code Geeks are giving away free JavaOne Tickets (worth $3,300)!
Would you like to go to JavaOne ? Besides being a cool conference its loads of fun with shows and events thru-out the city. Now you have a chance, Codename One and Java Code Geeks have teamed up to give away TWO full passes (worth $1,650 each) and to win all you need to do is: – Retweet this tweet: [ ...

Garbage Collection
We’ve been spending an excessive amount of time tuning our garbage collection and memory management of the new iOS VM based on profiler output. This is one of the cool features in the approach we took (translating Java to C rather than going directly to machine code), we can use Apple’s nifty profiling tools to see where the CPU/GPU spend their time. After quite a few profiling sessions it became apparent that the GC is the main reason for the performance overhead. Further digging showed that mutexes were the real issue here. ...

Not A Dialog – Again
When we introduced the idea of the EDT from Swing (and pretty much any modern UI toolkit) into what eventually became Codename One, one of the chief benefits was modal dialogs. Its the ability to block the executing thread in order to ask the user a question, that’s a very powerful tool for a developer. As a result of that we defined modal dialogs the way Swing/AWT defined them: stopping the execution of the code. ...

Keyboard Keys & Android Pipeline
Some features we have in Codename One are a bit hidden behind the surface, we add them as a patch for a developer and don’t have the proper place to document them so they get buried. Case in point is the ability in Android to use the search magnifier icon instead of the done button. To get that functionality you can just set a client property on the relevant text field as such: ...

Performance & Map Taps
We neglected to mention in our last post about the new graphics pipeline that it was authored by Steve Hannah who did a splendid job there! He just updated the shaders for the implementation to be far more efficient bringing performance back to the current levels. The true value of this architecture is that now we will be able to manipulate shaders for very complex effects at relatively low cost. ...

New Graphics Pipeline
Finally the new graphics pipeline is starting to trickle into the JavaSE port and the iOS port & once we iron those two out it should make its way into the Android port. With this in place we are finally at a point of functionality similar to JavaFX but without the overhead and performance implications that FX carries with it. The new pipeline includes new API’s for shapes, affine/perspective transforms and more. Notice that unless you are a graphics geek these things won’t mean much to you, but these things allow us to expose complex features (e.g. high performance charts, special effects) thru the high level API’s. Since not all devices will support these capabilities we they each include an is*Supported method in Graphics and if your painting code needs access to that capability it should test that availability and provide a reasonable fallback. Right now most of the capabilities should be supported for iOS and Java SE with Android support arriving later. ...