4

My aim is to get the keyboard to open as soon as the app is loaded. Using this code,

InputMethodManager inputMgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
                  inputMgr.toggleSoftInput(0, 0);`

on a button, I can get the keyboard to load when the button is pressed. However, when placed in the override onCreate() section, nothing happens.

Robert Longson
  • 118,664
  • 26
  • 252
  • 242
Jez Fischer
  • 657
  • 1
  • 8
  • 18

1 Answers1

8

Add the following line to the activity in AndroidManifest.xml

android:windowSoftInputMode="stateVisible|adjustPan"
Robert Longson
  • 118,664
  • 26
  • 252
  • 242
Jez Fischer
  • 657
  • 1
  • 8
  • 18