close KeyBoard - Android android.view.inputmethod

Android examples for android.view.inputmethod:KeyBoard

Description

close KeyBoard

Demo Code

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

public class Main{

    /* w  w  w. j  a v a2 s. c  o  m*/
    public static void closeKeyBoard(Context mContext) {
        InputMethodManager imm = (InputMethodManager) mContext
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm.isActive()) {
            imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT,
                    InputMethodManager.HIDE_NOT_ALWAYS); 
        }
    }

}

Related Tutorials