views:

259

answers:

2

I have 2 activities, A and B. When A starts, it checks for a condition and if true, it calls startActivityForResult() to start B. B only takes text input so it makes sense for the soft keyboard to automatically pop up when B start. When the activity starts, the EditText already has focus and it ready for input.

The problem is that the keyboard never shows up, even with windowSoftInputMode="stateAlwaysVisible" set in the manifest under the <activity> tag for B. I also tried with the value set to stateVisible. Since it doesn't show up automatically, I have to tap the EditText to make it show.

Anyone know what the solution might be?

A: 

(Shooting in the dark, but) have you tried requestFocus on the text box?

Roy Truelove
I tried that, it didn't work
Al
A: 

If requestFocus on an EditText isn't showing it, maybe this'll do it:

InputMethodManager imm = (InputMethodManager)getSystemService(
    Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mEditText, 0);

Look here for more information.

synic
I tried that, but it didn't work
Al