fix keyboard crash when no view in focus (#693)

This commit is contained in:
m2049r 2020-10-19 23:42:22 +02:00 committed by GitHub
parent a93e96d34c
commit f1b786ec3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -167,7 +167,9 @@ public class Helper {
static public void showKeyboard(Activity act) {
InputMethodManager imm = (InputMethodManager) act.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(act.getCurrentFocus(), InputMethodManager.SHOW_IMPLICIT);
final View focus = act.getCurrentFocus();
if (focus != null)
imm.showSoftInput(focus, InputMethodManager.SHOW_IMPLICIT);
}
static public void hideKeyboard(Activity act) {