Michael Zeuner
Michael Zeuner

Reputation: 1776

how do you make it so the Android keyboard doesnt open up when the user opens up my app?

can you make it so when you open up the app the on screen keyboard wont open up untill you click on one of the editText's?

Upvotes: 0

Views: 85

Answers (4)

aravindkanna
aravindkanna

Reputation: 683

it is up to your requirement. For suppose if you want to hide the keyboard every time the user opens your activity, then you can add android:windowSoftInputMode="stateAlwaysHidden" in your android manifest for your activity. If you want it dynamically then you can make change whenever event to close the keyboard occurs using

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

Use this as reference whenever you want

Upvotes: 0

xuchdeid
xuchdeid

Reputation: 41

in AndroidManifest.xml set android:configChanges="keyboardHidden"

Upvotes: 0

Amokrane Chentir
Amokrane Chentir

Reputation: 30385

In order to hide the virtual keyboard, you can use the InputMethodManager like this (you can put it in the onCreate()method of your landing activity) :

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

Upvotes: 1

azertiti
azertiti

Reputation: 3150

Add the following code in onCreate method of your activity:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

It did the trick for me :)

Upvotes: 0

Related Questions