Java tutorial
//package com.java2s; import android.content.Context; import android.view.*; import android.view.inputmethod.InputMethodManager; public class Main { public static void closeSoftInput(Context context, View focusingView) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(focusingView.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN); } }