The showSoftInputFromInputMethod method from the InputMethodManager class is deprecated in Android P.
As per the documentation, we should be using the InputMethodService.requestShowSelf(int) method for Android P and above.
Now the question is how can we get the reference for the class InputMethodService.
I tried creating a new object and calling requestShowself() on it but it doesn't work.
InputMethodService inputMethodService = new InputMethodService();
inputMethodService.requestShowSelf(0);
How can we use the suggested alternative for this deprecation for API 28 and above?
InputMethodServiceis implemented by IME apps. (e.g. gboard). If you're app developer and trying to show IME, useInputMethodManager.showSoftInput(TextView, 0);