Reputation: 869
I want to disable keyboard pop up in my activity. There will not be any keboard in the actvity. but hardware keyboard must work.how to do this? hardware buttons must work
Upvotes: 0
Views: 133
Reputation: 1715
Use this in your manifest:
<activity android:name=".SampleActivity" android:windowSoftInputMode="stateAlwaysHidden"/>
Upvotes: 1
Reputation: 1872
Just try below code.
InputMethodManager inputManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(editView.getWindowToken(), 0);
Upvotes: 1
Reputation: 15336
Managing soft keyboard in android is not that easy, although you can hide keyboard programatically.
private void hideKeyboard() {
//This will get any view in focus.
View view = this.getCurrentFocus();
if (view != null) {
InputMethodManager inputManager = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
note that Hardware Keyboard will work.
Upvotes: 0