Java tutorial
//package com.java2s; import android.os.Handler; import android.os.SystemClock; import android.view.MotionEvent; import android.widget.EditText; public class Main { public static void setKeyboardFocus(final EditText mEditText) { (new Handler()).postDelayed(new Runnable() { public void run() { mEditText.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, 0, 0, 0)); mEditText.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, 0, 0, 0)); } }, 100); } }