Java tutorial
//package com.java2s; import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; public class Main { @TargetApi(Build.VERSION_CODES.CUPCAKE) public static void toggleSoftInput(Context context, EditText edit) { edit.setFocusable(true); edit.setFocusableInTouchMode(true); edit.requestFocus(); InputMethodManager inputManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); } }