hide Soft Keyboard - Android android.view.inputmethod

Android examples for android.view.inputmethod:KeyBoard

Description

hide Soft Keyboard

Demo Code

import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

public class Main{

    public static void hideSoftKeyboard(View view) {
        if (view != null) {
            InputMethodManager inputMethodManager = (InputMethodManager) view
                    .getContext().getSystemService(
                            Context.INPUT_METHOD_SERVICE);
            inputMethodManager.hideSoftInputFromWindow(
                    view.getWindowToken(), 0);
        }//from  w  w w.  j ava 2  s. c  o  m
    }

}

Related Tutorials