Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.view.inputmethod.InputMethodManager; public class Main { /** * Toggles the SoftKeyboard Input be careful where you call this from as if you want to * hide the keyboard and its already hidden it will be shown * * @param context the context / usually the activity that the view is being shown within */ public static void toggleKeyboard(Context context) { InputMethodManager imm = ((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE)); imm.toggleSoftInput(0, 0); } }