Open Source & Free  

Questions of the Week IX

Questions of the Week IX

Header Image

This week has seen a lot of announcements and looking at the submission queue for next week it looks like
it will be jam packed with updates and new features. Today we have a new plugin update which is jam packed
with features and changes, the biggest of which is the removal of all the skins (they are now in the More menu
item).

We also have a lot of great new features in this plugin including Windows UWP build preview, new settings UI &
much more!

We’ll write more about all of those next week…​.

Stackoverflow was also brimming with great questions on a multitude of subjects.

How to enhance a class in Codename One API

This is probably my favorite question of the week because it’s a tough question that is asked rather frequently.
In this case it was asked in a proactive way (how can I do that, rather than why don’t you guys do that…​) which
is really nice making it my favorite.

Unfortunately there are no easy answers!
There is a reason why we shy away from adding too many VM level API’s, it’s damn hard to do.

Is there a way to save a Graphics object in Codename One without without taking a screenshot?

Graphics doesn’t always map to a surface which is why it doesn’t include capabilities such as getPixel.
This allows us to use rather elaborate hardware acceleration when running on some platforms and also
use two very different implementations of graphics (for screen drawing and mutable image drawing).

Need to access native interface code (android paypal integration)

Adding native 3rd party activities is a pretty common task for native SDK integrations…​

How to add an unselectedTab icon in codename one?

Reading that question I tend to agree, the API naming here is really unintuitive.

Video Display in Codename One

Most issues with web/video or other peer components boil down to wrong layout. Since the preferred size of the
media is 0 when we initially lay out the form it’s sized as 0 and stays that way…​ Using a different layout manager
works around that.

Log into a NTLM server with CodeName One

We got asked about NTLM support in the past but no one has emphasized this as important. It’s doable but
challenging, we could bake NTLM and other such capabilities directly into Codename One but to do that
we need to see enterprise customer demand.

How do I specify a degree character (U+00B0) in a Label

Our default encoding for source compilations was not UTF-8 for NetBeans/IntelliJ projects. We’ve changed this
for the upcoming update but this answer is still interesting…​.

How should the result of getDeviceDensity() method from Codename One be used?

Working with multi-DPI devices can be quite challenging and the device density aspect is often murky…​

Is it possible to save a generated image in Codename One?

The answer is yes (thru ImageIO) but the question goes more into the details of how to create an image in
terms of API’s…​

Provisioning profile does not match bundle identifier : Existing IOS bundle ID starts with a numeric

When we implemented Codename One we decided to tie package names to provisioning on iOS/Android/Windows etc.
This simplified a lot of the underlying code and logic but introduced edge cases like this. Unfortunately, there
are no easy answers for some problems…​

Store inherited class object in codename one storage

Externalization has always been a challenging subject for developers, there are some common pitfalls
that people fall into but it’s often messy to discover them the first time around. Caching is probably one
of the bigger pains during debugging as it defers the error to a later point…​

Best strategy for a magazine app

It’s always difficult to give advice on strategy/design. We can’t debug design and some things become obvious
only after trying a design and discovering it’s flaws, that is why it is crucial to build applications that are robust
enough to survive aggressive refactoring.

What would cause the “time” picker to display an hour that is different in the selector

This question picked up a bug in Codename One with meridiem time. Notice it took 4 days for the asker to figure
this out…​

If the question had included a test case this might have been resolved sooner.

Keypad decreases the screen Height issue

Centering elements in Codename One can be accomplished in several ways. I’m not a fan of the set paddings to
position elements approach though…​

Database replication best-practices in codenameone

Storage is hard in mobile devices which has given rise to a cottage industry of on-device-databases.
Some developers use sqlite but having used it for quite a few things I find it inherently quite flawed…​ We’d
love to have a better story for on device database that is ideally also more cross platform than our current options.

Instant messaging in coenameone

We often have samples covering many different things, e.g. we have an actual IM app sample that answers
this question:

Restrict user to record video for 3 seconds only

There are some things you can only do in native code at this time. Actually implementing a “proper” camera
view for most OS’s should be pretty trivial with a native interface and peer components. However, it would
require some understanding of the underlying OS semantics.

Create a CN1 JSON Array from POJO for Jackson

A lot of Codename One developers don’t even know about this great library from Steve, it’s pretty cool to see
developers finding out about it and figuring things for themselves!

Leave a Reply