user434885
user434885

Reputation: 2018

Android keyboard

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

Answers (3)

Computerish
Computerish

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

Nick H
Nick H

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

JOTN
JOTN

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

Related Questions