Latest posts from Codename One.
Blog

Codename One Graphics – Low Level Animations
In my previous post, I created a static analog clock component. In this post, I will use Codename One’s animation API to update the clock every continually so that it will keep time correctly. How Animation Works in Codename One From the Developer’s Guide: The Codename One event dispatch thread has a special animation “pulse” allowing an animation to update its state and draw itself. Every component in Codename One contains an animate() method that returns a boolean value, you can also implement the Animation interface in an arbitrary component to implement your own animation. In order to receive animation events you need to register yourself within the parent form, it is the responsibility of the parent for to call animate(). ...

Status Of The New VM & New Demo
Now that we are officially in the 64bit era of the iOS app store and our new VM is the default target it has gotten much stabler and helped us track issues that have been a part of Codename One since its inception. As part of improving the VM and fixing bugs we made a lot of changes to the VM including some core conceptual changes. One of the core changes we made is removing the reference counting . In our original architecture we created a reference counting/GC hybrid which seemed like a good idea in theory. In practice reference counters are surprisingly slow (despite their inaccurate reputation) this is mainly due to multi-threaded access which makes the reference counting code problematic. We tried many approaches but eventually after many experiments we just removed the reference counter completely and saw a big speed boost. Since our GC is concurrent and never stops the world (it can stop the allocating thread if its out of RAM) you shouldn’t see any stalls assuming your thread yields properly. ...

Codename One Charts
This post was written by Steve Hannah , one of the newest additions to the Codename One team and a long time community contributor. The upcoming update to Codename One will include a new package (com.codename1.charts) for rendering charts in your applications. This includes models and renderers for many common classes of charts including many flavours of bar charts, line charts, scatter charts, and pie charts. ...

Dr. Sbaitso
I recently flew to dev day at Riga , I was quite ill before the trip so it was pretty difficult and that’s the main reason I didn’t make a trip report like I normally do. However, the conference and the people running it did seem like a whole lot of fun that unfortunately I was in no shape to enjoy. I did prepare a demo/presentation for the trip though and since I gave my talk under the influence of medication I think its wise to post a tutorial to the demo I did here both for those who were in attendance and for the rest of the Codename One community. ...

Codename One Graphics Part 2: Drawing an Analog Clock
This post was written by Steve Hannah , one of the newest additions to the Codename One team and a long time community contributor. The new Codename One graphics pipeline includes support for advanced 2D and 3D transformations. Last time I talked about some of the new features in Codename One’s graphics. Then I presented an example app to demonstrate the use of the new shapes API. In this instalment, I will focus on some of the new graphics transformation features. ...

Web App Build Target
In the past we made several attempts at compiling Codename One applications to webapps, these were only partially successful. On the surface this seems relatively simple: just use something like GWT and the Canvas API to generate a web app. However, Codename One requires threads (for the EDT) and that’s just not something you can really hide. GWT is also problematic since it requires the source code rather than the bytecode of the application… ...

Location, iOS Beta Testing & Better Input
In recent versions of iOS Apple added the ability to distribute beta versions of your application to beta testers using tools they got from the testflight acquisition. We now support this with our crash protection pro feature, just use the build argument ios.testFlight=true and you can then submit your app to the store for beta testing. With iOS 8 Apple also introduced a requirement that’s important for you to be aware of if you use the location API. You need to state why you are using that API in the application meta-data. You can use the ...

Codename One Graphics
This post we written by Steve Hannah , one of the newest additions to the Codename One team and a long time community contributor. This is the first in a series of posts about drawing graphics in Codename One. In this tutorial, we will create a rudimentary drawing app to demonstrate how to use the Shape API. Some Background Codename One has included basic 2D graphics ability since its inception, but until recently, it was missing a few primitives that were required for drawing arbitrary graphics. Most notably, it did not include a general “Shape” API to draw arbitrary paths. This meant that most graphics were composed of images, a few common geometry primitives such as rectangles and circles, and clever use of tiling and clipping. If you wanted to draw an arbitrary shape composed of lines and bezier curves, you were generally out of luck. ...

Dr. Sbaitso Coming To Riga
I’ll be speaking at Riga Dev Day next week and I’ve been working on a demo for the conference. Back in my teen years I bought the SoundBlaster 1.0 which was one of the first affordable soundcards for the PC. One of the killer demos that shipped with it was a silly command line AI psychoanalyst by the name of Dr. Sbaitso that would try to dish out advice in all caps… ...

The toArray(new Array) Antipattern
NOTE : The information in this blog post is out of date. Codename One now fully supports the Collection.toArray(T[] arr) method, including the case where arr is an array of size 0. A recent issue in the issue tracker on the new iOS VM reminded me of a serious pet peeve and big design mistake in the Java Collections API, something that is just unfixable and wrong yet appears often in code from developers trying to be clever. ...

Game On
A Codename One community member Antonio Mannucci offered to release a gaming API that he created a while back. It took him some time but he finally delivered on his promise by releasing a cn1lib for simple 2D games in Codename One and a demo game to go with it. The project is still pretty rough in the sense that there is no real documentation or getting started guide. However, there isn’t much that needs saying… Just checkout the code and build the library then run the example demo. The demo has some issues that I’m unclear about but it looks promising. ...

Cats in Toolbars
Chen spent some time working on some Toolbar effects such as the rich title areas made popular by social network apps such as G+ & Twitter. The new Flickr demo in SVN now shows a really cool ability to fold the title bar as we scroll down and expand it when we scroll up. It also shows an image based title area that can fade out of view during scrolling. Check out the video below to get a taste of the possibilities. ...