Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove auto focus/keyboard popup of a field when the screen shows up?

I have a screen where the first field is an EditText, and it gains the focus at startup, also popups the numeric input type, which is very annoying

How can I make sure that when the activity is started the focus is not gained, and/or the input panel is not raised?

like image 725
Pentium10 Avatar asked May 23 '10 16:05

Pentium10


People also ask

How do I enable soft keyboard on Android?

By default, the soft keyboard may not appear on the emulator. If you want to test with the soft keyboard, be sure to open up the Android Virtual Device Manager ( Tools => Android => AVD Manager ) and uncheck "Enable Keyboard Input" for your emulator.


2 Answers

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(editTextField.getWindowToken(), 0); 

or

set activity property in manifest file as below in the application tag

android:windowSoftInputMode="stateHidden" 
like image 187
Mitul Nakum Avatar answered Sep 21 '22 05:09

Mitul Nakum


go to your application manifest file, and write this line for that activity you want to disable auto keyboard pop-up.

android:windowSoftInputMode="stateHidden" 
like image 22
sm.euro Avatar answered Sep 21 '22 05:09

sm.euro