Android: show soft keyboard automatically when focus is on an EditText
I\'ve read this post that automatically shows the virtual keyboard when a dialog box is shown.
What you can do is try using postDelayed(Runnable)
for EditText as below,
ettext.requestFocus();
ettext.postDelayed(new Runnable() {
@Override
public void run() {
InputMethodManager keyboard = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
keyboard.showSoftInput(ettext, 0);
}
},200);
Just try adding the below line before "et.setOnFocusChangeListener"
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
.showSoftInput(et, 2);