Niranjan Khandelwal
Niranjan Khandelwal

Reputation: 21

hide keyboard in android?

I am new to android development.

I am creating an application in which when app launches the edittextfield getfocus automatically and the keyboard pop-up.I want to hide the keyboard by default and show when edittextField get focus. I have tried this method but it's not working.

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

Upvotes: 1

Views: 1941

Answers (2)

Sadeshkumar Periyasamy
Sadeshkumar Periyasamy

Reputation: 4908

Declaring android:windowSoftInputMode="stateHidden" in corresponding activity tag on Manifest file will solve this. But study about this attribute here.

android:windowSoftInputMode

Upvotes: 1

Franklin Hirata
Franklin Hirata

Reputation: 21

Change your manifest file:

pput it there: (on your especific activity)

android:windowSoftInputMode="stateHidden"

Upvotes: 2

Related Questions