Reputation: 2018
My application starts with a bunch of text input fields, and I want that when starting up the the application. The virtual keyboard isn't open, but opens only when I click on one of the textinput fields. How do I do this?
Upvotes: 0
Views: 531
Reputation: 9591
I've used this approach to hide the keyboard after the user searches. You could use this in our onCreate
method:
Close/hide the Android Soft Keyboard
Quote from Reto Meier's accepted solution:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
Upvotes: 0
Reputation: 11535
In your onCreate
method you could get your first text view and call requestFocus()
on it. This ought to focus this field when the activity starts and bring up a virtual keyboard if needed.
If you want the keyboard not to appear on startup, request focus for a non-text element like a button.
Upvotes: 3
Reputation: 6317
You should leave the input method to the user. They might be using a physical keyboard or maybe even something like speech to text.
Upvotes: 1