Philipp F
Philipp F

Reputation: 924

EditText has focus when Activity starts, but soft keyboard is not shown

as mentioned above, the keyboard does not show up, although the EditText is focused (orange border) and the cursor is blinking. When I click into text field, it opens up, however I want it to be open right when the activity starts.

I tried setting android:windowSoftInputMode="stateVisible" in the activity, I tried showSoftInput(yourTextBox, InputMethodManager.SHOW_IMPLICIT); and also requestFocus(). But no success...

What could be the problem?

Upvotes: 1

Views: 3613

Answers (2)

Android-Droid
Android-Droid

Reputation: 14585

Another way to show the keyboard when the Activity is created is to add this code in your AndroidManifest file for the activity which you want to show the keyboard on starts :

<activity android:name=".UserLogin" android:windowSoftInputMode="stateAlwaysVisible"/>

Upvotes: 1

Aurelian Cotuna
Aurelian Cotuna

Reputation: 3081

Try something like this:

 EditText myEditText = (EditText) findViewById(R.id.editPasswd);

((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE))
    .showSoftInput(myEditText, InputMethodManager.SHOW_FORCED);

Are you testing on emulator? If you do, you should know that keyboard doesn't pop up on emulator :), but it does on a real device

Good luck, Arkde

Upvotes: 3

Related Questions