Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Android Bridge positioning issue - Page 2 — Gideros Forum

Android Bridge positioning issue

2»

Comments

  • @Venorcis closing keyboard seem to again differ from one Android version to another, or so they say
    http://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard
    Will need to experiment on what works better

    But about back button, then yes, what @petec says (there is even an example in docs ;) )
  • @ar2rsawseen Ah, I completely missed those (KeyCode is not the most striking name :P), thx @petec!
    How would I call the keyboard close action from LUA though?
  • The problem is that to get InputMethodManager you should use generic function that returns object and cast it to InputMethodManager class, which is not yet supported. But...

    The awesomest part about the bridge, that if you don't know, or can't (as in this case) run some specific Android code in lua, you can easily create method for it in GBridge.java class (or create your own class with static methods), like this:
    public static void hideKeyboard(){
    	InputMethodManager inputManager = (InputMethodManager)sActivity.get().getSystemService(Context.INPUT_METHOD_SERVICE);
    	if(sActivity.get().getCurrentFocus() != null)
    		inputManager.hideSoftInputFromWindow(sActivity.get().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
    }
    And call it in lua like this:
    local bridge = native.getClass("com.giderosmobile.android.plugins.bridge.GBridge")
    bridge.hideKeyboard()
    ;)
  • @ar2rsawseen That looks good, thanks a bunch! I will try it out soon :)
  • @ar2rsawseen Works like charm, thanks!
Sign In or Register to comment.