Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.Service; import android.content.Context; import android.view.inputmethod.InputMethodManager; import android.view.View; public class Main { public static void setKeyboardVisible(Context context, View view, boolean visible) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Service.INPUT_METHOD_SERVICE); if (imm == null) { return; } if (visible) { imm.showSoftInput(view, 0); } else { imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } } }