3

Possible Duplicate:
Close/hide the Android Soft Keyboard

I have a problem with the visibility of the keyboard in a view: I have an activity with its own view (layout) that contains a button "new". Clicking on the button is superimposed on a view (layout) with a transparent background and an EditText.

My question is:

I would like to bring up the keyboard immediately when I click on "new" and the new screen appears, I click on that new, new screen appears with the keyboard and click on the EditText without sull'edittext to bring up the keyboard. I hope I explained. How can I do?

Community
  • 1
  • 1
Alberto Deidda
  • 446
  • 1
  • 4
  • 13

2 Answers2

0

Programatically:

edittext.requestFocus();

Through xml:

<EditText...>
    <requestFocus />
</EditText>

either will set the focus on the your edittext at the beginning and as such will bring up your keyboard.

Max
  • 552
  • 2
  • 6
  • 22
0

You should add the following line to your activity in AndroidManifest.xml:

   android:windowSoftInputMode="stateAlwaysVisible"
sdabet
  • 17,379
  • 11
  • 73
  • 143