Latest posts from Codename One.
Blog

Teamwork (and other things)
While Java rocks for teamwork because of its strict and streamlined heuristics, our resource files are less ideal. However we are changing that in the next update to Codename One! The reason we chose to put everything into a binary resource file should be obvious: small size, portability. These are two critical features we had in mind when we designed the resource file format, we also wanted it to be really simple so we can e-mail it to our designer and so people could use it without an IDE (which back in 2006 was far more common). We initially thought about creating an XML file format which a special tool will convert into the res file format (and we had some prior work on the matter such as the XML ant tasks) but these proved to be cumbersome to maintain. ...

Use The Source
** Update: ** minor correction to the build process about the build.xml issue in the Codename One project. To me the biggest advantage in Codename One over pretty much any other mobile solution is that its realistically open source. Realistically means that even an average developer can dig into 90% of the Codename One source code, change it and contribute to it! However, sadly most developers don’t even try and most of those who do focus only on the aspect of building for devices rather than the advantage of much easier debugging. By incorporating the Codename One sources you can instantly see the effect of changes we made in SVN without waiting for a plugin update. You can, debug into Codename One code which can help you pinpoint issues in your own code and also in resolving issues in ours! ...

In A Pinch
Codename One has supported multi-touch and effectively pinch to zoom events from the very first release. However, it wasn’t intuitive to write code that would handle pinch to zoom. We just committed new pinch callback events to component which effectively allows you to zoom in/out with gestures. Effectively if you are interested in handling pinch you would just override: protected boolean pinch(float scale) and return true after handling the pinch operation. We did this to support our new ImageViewer class (where you can see a working sample of pinch), the image viewer allows you to inspect, zoom and pan into an image. It also allows swiping between images if you have a set of images (using an image list model). ...

You Can Bet On It
Recently the guys from Software Developer Journal contacted us about writing a mobile gaming article , since quite a few Codename One developers use it to write games we decided to accept the offer and I wrote an article titled: “Writing casual games In Java for mobile devices”. In this article we create a simple poker game mockup that is fully functional (although it doesn’t include betting, AI or networking), but you can drag the cards to have them replaced and click the deck to deal new cards. ...

Pushing It
We got a request from one of our pro-subscribers to support push notification on Blackberry devices. Normally we just implement the feature pro-developers ask for. However, in this case we were cautious… Building anything for/on top of a Blackberry device is often an exercise in futility. The gist of it though is that we were able to get it working despite the huge hassles. The main issue here isn’t the lack of documentation, its the over abundance of irrelevant, conflicting and misleading documents about a multitude of separate features of push related functionality on Blackberry devices. ...

Spanning, Caching, Native Fonts and more
When you have so many features as Codename One has things sometimes slip, a feature gets lost and even the guys who created it forget it was there. There are two such stories in this post one dates back to the very start of Codename One…. But first lets start with the other one. A month or so ago we added a component called SpanButton which has been requested by developers for quite a while. This is effectively a button that can break lines like a text area, its really a Lead Component internally (but that’s another post). ...

Jaring And Libraries
Don’t change the classpath Support for JAR files in Codename One has been a source of confusion despite my previous post on the matter so its probably a good idea to revisit this subject again and clarify all the details. The first source of confusion is changing the classpath. You should ** NEVER ** change the classpath or add an external JAR via the NetBeans/Eclipse classpath UI. The reasoning here is very simple, these IDE’s don’t package the JAR’s into the final executable and even if they did these JAR’s would probably use features unavailable or inappropriate for the device (e.g. java.io.File etc.). ...

Crashing
** Note: ** we decided to go in a different direction than the content of this blog post. We will make a new post with further details when we complete the new feature. Generally we found a way to allow deobfuscation of release binaries as well so you would be able to get a crash report on standard applications. In an ideal world your app would work perfectly on the device just as it does on the simulator, however that ideal world never exists under any development environment. Performance is different and unfortunately you occasionally get crashes on the device that you don’t get on a simulator. The reasons for this are many and varied, usually a crash means we did something wrong, but sometimes it might mean an exception was thrown and never caught or an API was misused. ...

Why Mobile Web Is Slow?
** Clarification update: ** For some reason people read this as a rebuttal of Drew Crawford article, ** it is not ** . It is merely a response, I accept almost everything he said but have a slightly different interpretation on some of the points. Over the weekend quite a few people wrote to me about a well researched article written by Drew Crawford where he gives some insights about why the mobile web/JavaScript is slow and will not (for the foreseeable future) compete with native code. My opinion of the article is mixed, it is well written and very well researched, I also agree with a few of the points but I think that despite getting some of the conclusions wrong I think his reasoning is inaccurate. ...

MoPub Ad Support
** Updated: ** We also added the option: ios.mopubTabletId which is required to build tablet compilant apps. It must point to a leaderboard ad unit. For a long time we’ve been looking for a proper partner on banner ads and could only find mediocre networks or worse. Unfortunately it seems the field of proper advertising on device is still problematic and we just couldn’t find anyone with an offering that will work properly across the globe/devices. ...

Handling The Exception
Handling errors or exceptions in a deployed product is pretty difficult, most users would just throw away your app and some would give it a negative rating without providing you with the opportunity to actually fix the bug that might have happened. Google improved on this a bit by allowing users to submit stack traces for failures on Android devices but this requires the users approval for sending personal data which you might not need if you only want to receive the stack trace and maybe some basic application state (without violating user privacy). ...

The Move To Java 5 And New Cloud E-Mail Support
We started moving the usages of Vector and Hashtable to use Map/Collection/HashMap & ArrayList. This follows our release of the full source code for our modified version of retroweaver and the Java packages that go with it. Recap: we had to change retroweaver which was designed to allow Java 5 code to run on Java 2 in order to get it to work with CLDC which is missing MANY features. ...