CodenameOne | platform framework for building truly native mobile apps | Mobile library
kandi X-RAY | CodenameOne Summary
kandi X-RAY | CodenameOne Summary
Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Inits the components .
- Create the menu for the given frame .
- Reset theme properties
- Tries to optimize the method
- persist component to xml
- Process HTML tag .
- Apply CSS styles to a CSS element .
- Generate code for a class .
- Creates a new component .
- Save an XML file to a file
CodenameOne Key Features
CodenameOne Examples and Code Snippets
JAVA_HOME=
$JAVA_HOME/bin/jlink --no-header-files --no-man-pages --compress=2 --strip-debug \
--add-modules \
--output java-runtime
jlink --no-header-files --no-man-pages --compress=2 --strip-debug -p --add-modules javafx.controls,javafx.fxml,javafx.base,javafx.graphics --output java-runtime
Community Discussions
Trending Discussions on CodenameOne
QUESTION
I am writing a program in Codenameone that will pull an array of products from a url and display them in a list. I want to reload the page every time I press a button, so I code in a method called reload that should delete everything in the form and then replace it all with the newly pulled list.
...ANSWER
Answered 2021-Jun-10 at 01:13removeAll()
doesn't recurse. That would be expensive and often redundant since the GC usually removes the entire tree.
Typically these problems are pretty simple to workaround though. There are two approaches:
Stop caching the component and re-create it every time you reload. This will mean it's never "already in" something
Before adding the problematic component just do:
problematicComponent.remove()
. This will remove it from its parent (or do nothing if it has no parent)
In your case it seems like you're doing this:
QUESTION
My CodenameOne app has a BrowserComponent in the layout (it's a WebView).
It has also other components like TextFields.
I need that the text in the BrowserComponent has the same size as the text in the TextFields (default value).
I set the text size inside the BrowserComponent in HTML, using the CSS font-size property.
I tried with this instruction:
...ANSWER
Answered 2021-May-29 at 09:39First: You should use getUnselectedStyle()
and not getStyle()
before getFont().
The getSize()
method is for system fonts as explained in the docs. You got the response of SIZE_MEDIUM which isn't what you want.
Try getHeight()
or getPixelSize()
after getFont().
QUESTION
My Android app is also being developed for iOS. For iOS versions <14 I am using a cross-platform tool, called CodenameOne. For cross-platform's sake it has limitations, of course.
I am trying to accomplish a simple import/export feature. My app can share simple json files.
Sharing is possible only with images in CN1 at present time. It is not useful to me, however I did not test it, usually they put files in the inbox of apps, it has to be checked according to use cases.
Sending an email with the sendMessage method does not work (it blocks the app, with or without attachments/recipients)
and moreover I would like that the user can do it in a pleasant way.
So I am using the app Documents directory as a folder for importing/exporting.
Also the custom extension is registered (it is not ".json").
Here are some ios build hints injected in the CN1 build system.
...ANSWER
Answered 2021-May-26 at 03:01UIFileSharingEnabled seems to be supported: https://developer.apple.com/documentation/bundleresources/information_property_list/uifilesharingenabled
But the casing is wrong and should be ios.fileSharingEnabled=true
.
As far as I can tell there's not support for ios.UISupportsDocumentBrowser
. Where did you get that build hint from?
You should use ios.plistInject
for unsupported hints. I suggest reviewing the resulting xcode project to see that things made it into the plist.
QUESTION
After passing a complex Codename One project from Ant to Maven with the appropriate tool (https://www.codenameone.com/blog/migrating-your-project-to-maven.html), in Netbeans 12.3 I have two problems:
when in the log there is the stack trace of a crash, clicking on the line of code (reported in the log) does not open the related Java file and automatically scroll to the line in question (with Ant it worked).
Netbeans reports me non-existent errors, even if it compiles correctly: these errors are all related to code that refers to libraries (before, with Ant, these errors were not reported).
Thanks for the suggestions
...ANSWER
Answered 2021-May-20 at 15:34I have good news, I solved both issues.
About the fake errors like in the screenshot, right-clicking on the "common" module of the Codename One project, there was an item "Resolve Project Problems" that I hadn't noticed before. The error was:
Your project has dependencies that are not resolved locally. Code completion in the IDE will not include classes from these dependencies or their transitive dependencies (unless they are among the open projects). Please download the dependencies, or install them manually, if not available remotely.
The artifacts are:
QUESTION
My CodenameOne app is mainly intended to be the iOS counterpart of an existing Android app. It is for older devices, in fact, as soon as possible, or in the future, a Swift app is going to replace it for OS 14>.
I need some customised icons and I have the svg code for it.
Initially I had to use the Flamingo tool, that converts svg files in Java classes. I used it like
...ANSWER
Answered 2021-May-18 at 02:10This specific UI is a bit out of date by now and wasn't used much even when it was added. Most users opted to do desktop scaling for multi images.
The scale option is designed to scale down from a high resolution image on the desktop. You don't want/need that.
You don't need to edit the file. Just make sure to turn on the XML team mode and make sure your images use the right file names. Then once you save the images will appear in the resource file.
I suggest adding a multi-image using the standard method of add in the menu. Then replacing all the generated images with your copies and reopening the file, then saving again (the last save is important as it will override the res file).
QUESTION
I am testing my CodenameOne app on iOS and I have troubles with this method:
...ANSWER
Answered 2021-May-17 at 07:57You don't need all this code. You can just use Util.readToString() to read the InputStream directly into a String.
QUESTION
My CodenameOne app needs customized icons for some buttons. Images have to be used.
The iOS version of my app was duly provided of those images in 1x 2x 3x formats.
It seems that the multi-image system of CN1 would beneficiate of the image resources of the Android version of my app.
Indeed XCode 1x, 2x, 3x images could lead to strange assignments of "the closest alternative" as it reads in the CN1 dev guide, I think.
...ANSWER
Answered 2021-May-14 at 03:26We have multi-image that works in a way similar to androids DPI level. They don't use the iOS convention since we support more device resolutions than iOS. This works both in the CSS and designer. See the developer guide on multi-image for more details.
QUESTION
My CodenameOne app needs that some buttons have special icons. ScaleImageButton is the component that is suitable. The icons to be used are from the material icons repository, but some are modified, so the CN font is not suitable.
I created the icon images with the Flamingo tool that converts svg to java classes. It is cumbersome but it can be useful and practical, but at present time the resulting Java classes are not working on iOS.
It works on the CN simulator and Android although the button size is not exact: if state-changes reflect on some icon-changes, the layout would be rearranging and uneven.
On iOS, in addition to that, the drawing is huge or tiny in its viewport, depending of the button size that is assigned to the Flamingo image.
...ANSWER
Answered 2021-May-13 at 02:50The "right way" to do this is to add the images to the res file as that's the most portable way. You can do that via the theme or by including the images in your CSS, both options are discussed in the developer guide.
You can also create a separate resource file for each icon set and you can give any name you want to the icons within.
We don't support hierarchy for assets in Codename One. There's a special case for HTML which uses TAR to workaround platform differences but overall we don't allow that to avoid different behaviors between platforms.
QUESTION
Thx to Steve for the CN1 ant to maven migration tool and video here. - Has anyone been able to run the Kitchen Sink project in Netbeans after migration? I follow the video instructions with the migration tool and migrate successfully and it runs from command line with ./run.sh but when I go to run it in NetBeans, I had a lot of 501 (https needed) errors. Added umer's code from here and that solved the 501 errors but now get:
- Invalid POM for com.codenameone:codenameone-javase:jar:7.0.23, and
- No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound. while locating org.apache.maven.plugin.surefire.SurefirePlugin.
Note invalid POM warning...
...ANSWER
Answered 2021-Apr-17 at 02:01I think perhaps the method I'm using to detect the latest version of cn1 has issues. It picked 7.0.23 which was released this morning. But then it was unable to find some of the jars.
Probably it will work if you just try running the project again as it should be fully propagated to maven central now.
QUESTION
I have an issue when I try to build the application IOS to CodenameOne Server, I get this error :
Failed to extract git version from git --version
("xcrun: error: active developer path ("/Applications/Xcode10.1.app/Contents/Developer") does not exist\nUse sudo xcode-select --switch path/to/Xcode.app
to specify the Xcode that you wish to use for command line developer tools, or use xcode-select --install
to install the standalone command line developer tools.\nSee man xcode-select
for more details.\n")
Anyone can help me with this issue? Thanks in advance.
...ANSWER
Answered 2021-Apr-27 at 01:40We pushed a fix for this. This broke with our update to xcode on the servers as required by Apple. It should work now.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install CodenameOne
NOTE: We are in the process of migrating from Ant to Maven, which simplifies the process for building from source. See Ant Quick Start for the legacy Ant build instructions. The setup is covered in depth in this article and video. IMPORTANT: Building Codename One requires JDK 8, currently. You cannot use JDK 11 as some sub-modules must use -source 1.5 and -target 1.5 to maintain backward compatibility with parts of the toolchain.
This will build and install Codename One in your local Maven repository. This process can take a while since it automatically downloads dependencies with a size of ~1GB.
The Samples directory contains a growing set of sample applications. These samples aren't meant to be demos, but rather samples of how to use APIs.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page