views:

25

answers:

1

My function, run from the onResume() does not cause the keyboard to appear.

Am I doing it wrong?

private void showKeyboard() {
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(txtSearch, InputMethodManager.SHOW_FORCED);
txtSearch.requestFocus();}
A: 

The soft keyboard can be tricky sometimes. I belive the last line, txtSearch.requestFocus() is unnecessary, and could actually be screwing things up. By telling the keyboard to SHOW_FORCED on txtSearch you are already telling it to have focus.

Mayra
Hmm. I tried with that line and with out. It has been a tricky test, I have not been able to successfully show the keyboard via code.
BahaiResearch.com