Skip to content Skip to sidebar Skip to footer

Javafx With Android - Api

I'm trying to use Android specific code in a JavaFx Project. I wrote a litte game on JavaFX and when I use JavaFX-Ports I can run this Game on my Android Handy. Now I want to displ

Solution 1:

For starters, you don't need to add those dependencies: the jfxmobile plugin does it already for you.

You may have a look at the Gloun plugin for NetBeans, to create a new JavaFX project with JavaFXPorts.

Now, in this new project, if you want to add some Android code, you have to add it on the Android/Java package.

One way to start is, as you have already pointed out, by following HelloPlatform. It includes a PlatformService to load for you the class depending on the platform you are running. Thanks to that, you can load AndroidPlatformProvider if you are on Android. So you would have to provide the methods you want to call from your main class, regardless the platform, and implement them on each platform (at least with dummy content).

You can also have a look at this question, as it provides a full solution with android code.

Post a Comment for "Javafx With Android - Api"