diff options
| author | reduz | 2014-04-06 02:01:51 -0300 |
|---|---|---|
| committer | reduz | 2014-04-06 02:01:51 -0300 |
| commit | ded365031ede27b7a6efef59bc886343f58d310b (patch) | |
| tree | 5561d8e012f54771641780595fe24a257f8dedb1 /platform/android/java/src | |
| parent | b4969373b3475799d6b24cdffeda4659c37f0b8a (diff) | |
| parent | f103b67326376b76100ddb6373c5962378d44119 (diff) | |
| download | godot-ded365031ede27b7a6efef59bc886343f58d310b.tar.gz godot-ded365031ede27b7a6efef59bc886343f58d310b.tar.zst godot-ded365031ede27b7a6efef59bc886343f58d310b.zip | |
Diffstat (limited to 'platform/android/java/src')
| -rw-r--r-- | platform/android/java/src/com/android/godot/GodotIO.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/platform/android/java/src/com/android/godot/GodotIO.java b/platform/android/java/src/com/android/godot/GodotIO.java index 4b6a44335..605e7ae36 100644 --- a/platform/android/java/src/com/android/godot/GodotIO.java +++ b/platform/android/java/src/com/android/godot/GodotIO.java @@ -472,8 +472,13 @@ public class GodotIO { public void hideKeyboard() { - InputMethodManager inputMgr = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE); - inputMgr.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); + InputMethodManager inputMgr = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE); + View v = activity.getCurrentFocus(); + if (v != null) { + inputMgr.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); + } else { + inputMgr.hideSoftInputFromWindow(new View(activity).getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); + } }; public void setScreenOrientation(int p_orientation) { |
