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

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

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

html - jQuery UI Sortable - Remove placeholder after item is dropped -