Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8304476

[Android] Software keyboard doesn't show up

XMLWordPrintable

      After the fix for JDK-8296621 (starting 20-ea+11), which removed a focus request after setting the scene, when running on Android, the JavaFX stage doesn't get focused, and therefore textField/textArea controls don't get to show the keyboard if they are not focused (see https://github.com/openjdk/jfx/blob/master/modules/javafx.controls/src/android/java/javafx/scene/control/skin/TextFieldSkinAndroid.java#L46 for instance).

      Restoring the focus request fixes the issue (or running with any version before 20-ea+11).

      Workaround: as a possible workaround for now, manual focus request, some time after the stage is shown, works:

          public void start(Stage stage) {
              ...
              stage.show();

              PauseTransition pauseTransition = new PauseTransition(Duration.millis(100));
              pauseTransition.setOnFinished(f -> stage.requestFocus());
              pauseTransition.playFromStart();
          }

            tsayao Thiago Sayao
            jpereda Jose Pereda
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: