Reputation: 1776
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
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
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
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