Merge pull request #255 from sikakraa/android_kb_fix

Fixed Android crash by adding safety to the hideKeyboard() -function.
This commit is contained in:
reduz 2014-04-06 02:01:51 -03:00
commit ded365031e

View file

@ -473,7 +473,12 @@ public class GodotIO {
public void hideKeyboard() {
InputMethodManager inputMgr = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMgr.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
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) {