0

We are working on a GluonMobile App and the keyboard on Android an iOS is only showing up once, also it is hiding TextFields that are near the bottom of the screen itself.

We wanted to implement the solution provided here: How to make the SoftKeyboard show up again

However, after adding all the necessary classes we are not able to deploy it, we get the following errors:

C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:3: error: package android.graphics does not exist
import android.graphics.Rect;
                       ^
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:4: error: package android.view does not exist
import android.view.ViewTreeObserver;
                   ^
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:5: error: package android.view.inputmethod does not exist
import android.view.inputmethod.InputMethodManager;
                               ^
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:13: error: package javafxports.android does not exist
import javafxports.android.FXActivity;
                          ^
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:19: error: cannot find symbol
  private final InputMethodManager imm;
                ^
  symbol:   class InputMethodManager
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:21: error: cannot find symbol
  private Rect currentBounds;
          ^
  symbol:   class Rect
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:24: error: package ViewTreeObserver does not exist
  private ViewTreeObserver.OnGlobalLayoutListener layoutListener;
                          ^
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:50: error: package ViewTreeObserver does not exist
  private ViewTreeObserver.OnGlobalLayoutListener layoutListener(DoubleProperty height) {
                          ^
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:17: error: cannot find symbol
  private static final float       SCALE  = FXActivity.getInstance().getResources().getDisplayMetrics().density;
                                            ^
  symbol:   variable FXActivity
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:29: error: cannot find symbol
    imm = (InputMethodManager) FXActivity.getInstance().getSystemService(FXActivity.INPUT_METHOD_SERVICE);
           ^
  symbol:   class InputMethodManager
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:29: error: cannot find symbol
    imm = (InputMethodManager) FXActivity.getInstance().getSystemService(FXActivity.INPUT_METHOD_SERVICE);
                                                                         ^
  symbol:   variable FXActivity
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:29: error: cannot find symbol
    imm = (InputMethodManager) FXActivity.getInstance().getSystemService(FXActivity.INPUT_METHOD_SERVICE);
                               ^
  symbol:   variable FXActivity
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:35: error: cannot find symbol
    currentBounds = new Rect();
                        ^
  symbol:   class Rect
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:42: error: cannot find symbol
    FXActivity.getViewGroup().getViewTreeObserver().addOnGlobalLayoutListener(layoutListener);
    ^
  symbol:   variable FXActivity
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:45: error: cannot find symbol
      l.addListener(LifecycleEvent.RESUME, () -> FXActivity.getViewGroup().getViewTreeObserver().addOnGlobalLayoutListener(layoutListener));
                                                 ^
  symbol:   variable FXActivity
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:46: error: cannot find symbol
      l.addListener(LifecycleEvent.PAUSE, () -> FXActivity.getViewGroup().getViewTreeObserver().removeOnGlobalLayoutListener(layoutListener));
                                                ^
  symbol:   variable FXActivity
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:55: error: cannot find symbol
    FXActivity.getViewGroup().getRootView().getWindowVisibleDisplayFrame(currentBounds);
    ^
  symbol:   variable FXActivity
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:72: error: cannot find symbol
      imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
                          ^
  symbol:   variable InputMethodManager
  location: class AndroidKeyboardService
C:\GluonApp\src\main\java\com\gluonhq\charm\down\plugins\android\AndroidKeyboardService.java:79: error: cannot find symbol
      imm.toggleSoftInput(0, InputMethodManager.HIDE_IMPLICIT_ONLY);
                             ^
  symbol:   variable InputMethodManager
  location: class AndroidKeyboardService
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
19 errors
:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

What would the imports be or how can we successfully deploy it?

  • If you want to implement a service that uses Android API, have a look at the Go Native sample [here](https://github.com/gluonhq/gluon-samples/tree/master/go-native). Try to make it work, and if you do, the `KeyboardService` from the mentioned question is implemented in the very same way. – José Pereda Apr 23 '18 at 08:47
  • We will try this with help from our lecturer by chance, since we are on a tight schedule. If we achieve this (also the location stopping), we will rise a pull request to the Gluon repo to contribute back. – BodenDokDevs Apr 24 '18 at 07:17
  • See Charm Down [3.8.0](https://bitbucket.org/gluon-oss/charm-down), it has just been released with a bunch of new features. – José Pereda Apr 24 '18 at 07:21
  • PositionService works perfectly, will see if it solves the keyboard problem tomorrow as well. – BodenDokDevs Apr 24 '18 at 21:00

0 Answers0