Formatting float in each platform in libGDX

If you found a problem with formatting float in GWT I am presenting a solution similar to described here in official libGDX wiki page (based on interfacing with platform specific code).

As you have probably noticed String.format() is not supported by GWT. We need to use alternative class NumberFormat from gwt client library, which is a simple replacement.

Firstly we need to edit our build.gradle file and add missing dependencies to html project.

Then we should refresh all gradle projects.

Next step is adding interface to core project.

Subsequently we create implementation for each platform.


desktop & android:

Then inside core project we need to add constructor to ApplicationListener.

We also need to edit each starter class as following.




Now to recieve formatted float we just need to call: