2

I am using a custom layout on an AlertDialog. The custom layout has an EditText filed which I am using to get a phone. When I display the AlertDialog, in order to get the keyboard to type in the phone number you have to click on the EditText filed. Is there a way to get the keyboard to automatically pop up when I bring up the AlertDialog so that the user does not have to click on the EditText filed to get the Keyboard.

Thanks, Prasanna

MatrixFrog
  • 20,873
  • 10
  • 56
  • 88

1 Answers1

3

Just add this line when you are showing your dialog:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
Ross Hambrick
  • 5,640
  • 2
  • 40
  • 33