How to close/hide custom keyboard Android -


i've try close custom keyboard after click item in gridview.i'm trying in baseadapter class. context come inputmethodservice.

so far i've tried below:

framelayout scroll = (framelayout)inflater.inflate(r.layout.keyboard, null);  inputmethodmanager imm = (inputmethodmanager)context.getsystemservice(context.input_method_service);         imm.hidesoftinputfromwindow(scroll.getwindowtoken(), 0); 

--

imm.togglesoftinput(0,inputmethodmanager.hide_implicit_only); 

--

 scroll.setvisibility(view.invisible); 

thanks

i'm copying , pasting app here, works fine us:

   public static void hidekeyboard(view v) {       try {          v.clearfocus();          inputmethodmanager imm = (inputmethodmanager) v.getcontext().getsystemservice(context.input_method_service);          imm.hidesoftinputfromwindow(v.getwindowtoken(), 0);       } catch (exception e) {          // saw shit happening on code before       }    } 

Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -