Latest posts from Codename One.
Blog

When You Cannot Afford to Block the EDT
We recently added support for disabling invokeAndBlock() for certain sections of code. The syntax is: CN.invokeWithoutBlocking(()->{ // This code is not allowed to call invokeAndBlock() }); If any attempt is made to execute invokeAndBlock() inside that block of code, it will throw a BlockingDisallowedException. This can be useful for ensuring that your UI will be responsive, especially in cases where you’re building a new form to show to the user, and any delay will be noticed by the user. ...

Updates and Expansion
I haven’t blogged in a while. I’ve been busy working with a couple of startups, some enterprise customers and bringing new people on-board. Steve has been great in picking up some of the slack but his plate is too full to blog with the same frequency I had so the blog slowed down a bit during this time. I hope to pick it back up to a weekly post regiment but my schedule is just so tight I barely have time to breath. ...

Runtime Debugging with Groovy Console
We recently added a new tool to the Codename One simulator that will allow you to run arbitrary code snippets in your app’s runtime environment. You can access it from “File” > “Groovy Console”, while your app is running in the simulator. This will open the following dialog that will allow you to execute arbitrary Groovy code: As you may suspect, you should use the Groovy programming language in this console. If you’re not familiar with Groovy, don’t worry. The language is basically just Java with some nice short-cuts. In fact, in many cases, you can probably just write Java code, and it will still work. Personally, I like the way that Groovy lets you refer to object properties via their property name, so you don’t need to use the getter or setter methods explicitly. E.g. You can do “form.title”, instead of “form.getTitle()”, to get the form’s title. The former is converted into the latter automatically for you. ...

WKWebView and PRs
We still have features to cover from our summer vacation but we need to make a short de-tour through newer things that landed recently. One of the big highlights is the switch to WKWebView. We effectively changed the default iOS browser component to WKWebView instead of UIWebView. This resolved warnings Apple started sending out to developers about using the out of date UIWebView. This mostly went unnoticed by most developers as it should. But if your browser starts acting up this is the reason. There isn’t much we can do here as we knew that day would come where Apple will demand a switch. ...

Push Cheatsheet
Push support is one of the most complicated features to set up, due to all of the red tape you have to cut through on each platform. Each platform has its own series of hurdles you have to jump through. Apple (iOS) requires you to generate push certificates. Google (Android) requries you to set up a project in Firebase console. Microsoft requires you to register your app for the Windows store. And that’s just the beginning. ...

Terse Table, Radar Chart and Networking Enhancements
This is the 3rd installment of the updates we did over the summer and so far it isn’t the last one. We have at least one more part coming in next week… Terse Table Layout TableLayout is pretty darn verbose e.g. this snippet from the TableLayout JavaDoc: cnt.add(tl.createConstraint(). horizontalSpan(2). heightPercentage(80). verticalAlign(Component.CENTER). horizontalAlign(Component.CENTER), new Label("Span H")). add(new Label("BBB")). add(tl.createConstraint(). widthPercentage(60). heightPercentage(20), new Label("CCC")); This is pretty verbose and a bit painful to write so we added shorthand methods: ...
Icon Fonts, Popups and Infinite Scroll
As I mentioned in the last post there are a lot of new features we need to go over and it will take time to cover everything. In fact this is still a partial list and there’s a lot more on the way… Easier Icon Font Integration First off Thomas submitted a PR for a few new font icon methods: Specifically in Label he added: public void setFontIcon(Font font, char c); public void setFontIcon(Font font, char c, float size); And in FontImage he added: ...

We're Back from Vacation
Summer is finally over and the kids are going back to school/kindergarten so it’s time to go back to our regularly scheduled posts. I won’t be posting as often as before as I’ll dedicate more time for support/development activities but still there’s a lot to write about… During our time off we had a lot of changes, I’ll repeat a few big ones which you might have run into already and cover a few that might have gone under the radar. ...

Summer Vacation
You might have noticed we’ve been a bit slow with updates over the past couple of weeks as we’re dealing with a bit of a backlog. With the kids on holiday from school it’s harder to keep up not to mention our travel plans for the summer. As such we’re officially in summer vacation until September. During this time we won’t update the blog as that takes a bit too much. We will probably have Friday releases if warranted but this depends on commits. It will take us longer to evaluate some issues but we’ll still try to respond to everyone in a reasonable timeframe. Pro and enterprise support might be impacted as well due to personnel availability but should still provide fast response turnaround. ...

Post Message
BrowserComponent is a pretty powerful tool when you just want to integrate HTML into your application. We use it a lot in native apps, but surprisingly it’s just as useful when we compile an app as a web application. It lets us embed HTML into the web application. But there’s a big caveat known as SOP when we do that. SOP and CORS SOP is the “Same Origin Policy” enforced by browsers. It’s prevents CSRF (Cross Site Request Forgery) which essentially lets a site pretend it’s a different site. ...

Flamingo SVG Transcoder Revisited
A couple of years ago I wrote about our support for Flamingo which translates static SVG files to Java source files that you can treat as images within Codename One while getting pixel perfect resolution independent results. There were a few minor changes since until a month ago when Steve committed some work to address this RFE. What’s SVG and Why Should I Care? If you’re new to SVG here’s a quick primer. There are two types of images: Vector and Raster. Raster is what most of us work with every day. They are our JPEG, GIF, BMP and PNG images. They store the pixels of the image. There are many nuances here but I’ll leave it at that… ...

Sheets and Samples
Over the years we wrote a lot of demos for Codename One as well as a lot of test cases. This can get painful after a few dozen projects each of which with their own version of the JARs and build script. To solve this never ending need to organize samples Steve introduced a new samples folder into the open source project. This makes it easy to build/run samples if you’re command line inclined. All you need is an install of Java and Ant to be in business. Steve introduced this quite a while back but it took a while to reach a critical mass of samples which it recently passed. By now the samples cover a lot of the functionality of Codename One. There’s a lot of documentation for the samples folder here so I won’t go too much into details. I will however refine a few steps in the getting started process… ...