diff --git a/examples/android/keyboard/java/src/io/v/android/ex/VKeyboardActivity.java b/examples/android/keyboard/java/src/io/v/android/ex/VKeyboardActivity.java index 1ff47bf..cd86664 100644 --- a/examples/android/keyboard/java/src/io/v/android/ex/VKeyboardActivity.java +++ b/examples/android/keyboard/java/src/io/v/android/ex/VKeyboardActivity.java @@ -62,18 +62,18 @@ protected void onDestroy() { protected void onPause(){ super.onPause(); thiz.hideSoftKeyboard(); - } + } - @Override + @Override protected void onResume(){ super.onResume(); if(thiz.hiddenEditText == null) { return; } thiz.showSoftKeyboard(); - } + } - public static void setSoftKeyboardBuffer(String text) { + public static void setSoftKeyboardBuffer(String text) { if(thiz.hiddenEditText == null) { Log.e(TAG,"No keyboard initalized"); return; @@ -88,7 +88,7 @@ public void run() { }); } - public static void showSoftKeyboard() { + public static void showSoftKeyboard() { //Log.d(TAG,"showSoftKeyboard called"); final EditText editText = new EditText(thiz); @@ -110,7 +110,13 @@ public void run() { editText.requestFocus(); InputMethodManager imm = (InputMethodManager) thiz.getSystemService(Context.INPUT_METHOD_SERVICE); - imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + + if (android.os.Build.VERSION.SDK_INT < 33) { + // NOTE: deprecated in "TIRAMISU" (API 33) + imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + } else { + imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); + } editText.addTextChangedListener(new TextWatcher() {