D.Blazer D.Blazer - 1 year ago 91
Java Question

Using MikePenz drawer, where can i handle onDrawerOpen, close soft keyboard

i am using mikepenz drawer, i want my softkeyboard to be closed when ik open my drawer, didnt have a problem with doing this with the on hamburger item press, but can find where to handle closing the keyboard on opening the drawer by sliding.

Answer Source

after the information t0mm13b pointed me to, this is how i did it.

    result = new DrawerBuilder()
            .withOnDrawerListener(new Drawer.OnDrawerListener() {
                public void onDrawerOpened(View view) {

                public void onDrawerClosed(View view) {

                public void onDrawerSlide(View view, float v) {

remove soft keyboard method

public void removeSoftKeyboard() {
    InputMethodManager inputMethodManager = (InputMethodManager) this.getSystemService(Activity.INPUT_METHOD_SERVICE);
    inputMethodManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download