Latest posts from Codename One.
Blog

TIP: Use Weak References
One of the less familiar features of Java is the mess of weak/soft/phantom references. This is a confusing mess and it’s compounded by the fact that other languages (such as the reference counting Swift/Objective-C) have used these terms with a different meaning. To simplify this weak references in a garbage collected language allows you to keep a pointer (reference) to an object that won’t force it to stay in RAM. ...

Tutorial – Versioned Builds/Repeatable Builds
Versioned builds are one of the more confusing features of Codename One mostly because the word “version” is so overloaded with meaning. The feature itself is remarkably simple as explained in this video tutorial. Versioned builds allow you to build against a fixed point release version of Codename One, that means that if we break something in the build servers you can still work against the last major version that we released. ...

Media Controls and Print Developer Guide
I did a lot of work on the developer guide PDF making it more suitable to print, as part of this work I submitted the guide to Amazons KDP which means you can now order a physical book of the developer guide. I reduced the page count significantly for lower cost and image size requirements. As a result the book is much smaller but contains the exact same information in a denser package. ...

TIP: Using Lombok and Other tools
A few weeks back maaartinus asked on stack overflow whether we can get lombok working with Codename One. After a short back and forth it seems that this was as easy as I’d hoped and he was able to get it working without a change. Personally, I like our approach of property objects more but that’s obviously a matter of taste. Lombok works by processing the bytecode after compilation to convert annotations to terse code. E.g. this Java code using Lombok: ...

Tutorial – Desktop and JavaScript Ports
Codename One has ports for Mac, Windows & even for the browser. These are often confused and the introduction of the UWP port which also includes some overlap only made matters worse. Each one of these ports covers a segment that the other ports don’t. In this tutorial I try to separate the various ports & explain when each one of them should be used. I also dispel common misconceptions about these ports. Archived Comments This post was automatically migrated from the legacy Codename One blog. The original comments are preserved below for historical context. New discussion happens in the Discussion section. ...

Security, Map Tutorial and ComScore
I’ve added two modules recently to the deep dive course in the academy. These are a part of a trends together with the SMS activation posts I’ve done over the past couple of weeks. These are all preparations for the upcoming Uber demo that will launch before the end of the year. So the first module I added is a security module which I think I mentioned before, the one I added just last week explains the process of working with native maps and the various types of maps we have in Codename One. It goes all the way from basic to drawing stuff on top of the map and building for the various devices (including plot twists like build failures…). ...

TIP: Activation UI and the Builder Pattern
I wrote two posts about the SMS activation process. In the first I discussed using the Twilio API via REST and in the second I discussed the native interfaces for SMS interception we can use in Android. Now it’s time to put this all together and create a single API that’s fluid. It should include the full UI process but be flexible enough to let you design your own experience. ...

Tutorial – Offline Build
Offline build is a pretty complex topic which is why we opted for the online build process in Codename One. It allows for simple install/build and doesn’t require a Mac. However, if you work for a bank or a government agency using a cloud solution is sometimes an insurmountable roadblock. That’s why we introduced the offline build option to replace our old private cloud option. It isn’t ideal, building offline essentially forfeits some of the key advantages of Codename One and surprisingly slows down the build process (our servers are really fast). But when developers need to choose between this and the other available options there is still some appeal. In this tutorial I scratch the surface of offline build and also explain its unique licensing status. Unlike the standard Codename One services, this is an offline service so it will keep building even without a license. This is especially important for enterprises that need safety moving forward and a guarantee they will be able to build their apps in the future. ...

Always on Top and Style Parser
It’s been a busy week with 3.7.3 released and a lot of new things. Diamond made several PR’s over the past couple of weeks but one interesting PR is an “always on top” feature for the simulator which is exactly what it sounds… This is very useful for me personally as it will allow me to film coding while showing the simulator floating on top (thanks Diamond!) but it should be super useful for everyone. You can inspect the code/debugging values while the simulator floats on top. You can activate it using the simulator menu option. ...

TIP: Intercept Incoming SMS on Android
Last week I talked about using SMS to activate your application which is a pretty powerful way to verify a user account. I left a couple of things out though. One of those things is the ability to grab the incoming SMS automatically. This is only possible on Android but it’s pretty cool for the users as it saves on the pain of typing the activation text. Broadcast Receiver In order to grab an incoming SMS we need a broadcast receiver which is a standalone Android class that receives a specific event type. This is often confusing to developers who sometimes derive the impl class from broadcast receiver… That’s a mistake… ...

Tutorial – Crash Protection
Continuing the trend I revisited the old crash protection video in the “how do I” section and updated it with current information and details. The old video still featured an old flag that should be avoided… The new video is relatively short and simple as the feature isn’t very complex, I hope to produce several more of these and bolster the video section further. On a different subject I also neglected to mention the new security related module in the Codename One Academy courses. I’ll drop additional videos there later in the month. Archived Comments This post was automatically migrated from the legacy Codename One blog. The original comments are preserved below for historical context. New discussion happens in the Discussion section. ...
Pixel Perfect – On Top Menu
I already have half a post on text components but I’ve put that on hold for now as I’ve been working on the on-top side menu to supersede the existing side menu bar implementation. I’ve made some fixes for it over the week, I wanted to make it the default for Codename One apps but it still isn’t “perfect”. We will make it the default within the next couple of weeks so please test it after this weeks update and let us know ASAP if you spot any issues! ...