In Android, to have the keyboard be numeric only, you only need to set the inputType as number. In Javafx, you must make sure you have the correct properties set, in this case,
System.setProperty("com.sun.javafx.isEmbedded", "true");
System.setProperty("com.sun.javafx.virtualKeyboard", "javafx");
and then you set textfield.getProperties().put("vkType", "numeric");
This is not working for me at all. I have tried to add it in Gradle build, which did not work.
I have tried adding it in the init method, as below.
@Override
public void init() {
System.setProperty("com.sun.javafx.isEmbedded", "true");
System.setProperty("com.sun.javafx.virtualKeyboard", "javafx");
addViewFactory(HOME_SCREEN_VIEW, () -> new HomeView().getView());
addViewFactory(STATION_LIST_VIEW, () -> new StationListView().getView());
addViewFactory(STATION_VIEW, () -> new StationView().getView());
addViewFactory(CHOOSE_FLIGHT_VIEW, () -> new ChooseFlightView().getView());
addViewFactory(SETTINGS_VIEW, () -> new SettingsView().getView());
addViewFactory(LOGIN_VIEW, () -> new LoginView().getView());
addViewFactory(EDIT_PREF_VIEW, () -> new EditingPrefView().getView());
addViewFactory(SPLASH_VIEW,() -> new SplashView().getView());
addViewFactory(OVERLOAD_VIEW, () -> new OverloadView().getView());
addViewFactory(ADDUSER_VIEW, () -> new AddUserView().getView());
}
It also did not work. I have looked into the .apk and I found a javafx.platform.properties. file, which has android.com.sun.javafx.isEmbedded=true in it. If I change the properties to add in the android., it still does not work.
How can I make this work? I am using a normal JavaFx TextField, not Gluon TextField.
If at all possible, I would actually prefer to use the native Android numeric keyboard, but I haven't found any way to do that either.
Thanks for the help.