Android Hide Keyboard
I am working on android Tab which has external keyboard. So I need to remove the android soft keyboard pop on my App. I tried so many ways to do it, none of it works for me because
Solution 1:
try this
editView.setOnFocusChangeListener(newView.OnFocusChangeListener() {
@OverridepublicvoidonFocusChange(View v, boolean hasFocus) {
if(hasFocus){
editView.postDelayed(newRunnable() {
@Overridepublicvoidrun() {
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edtView.getWindowToken(), 0);
}
},1);
}
}
});
Solution 2:
call below function whenever you want to hide keyboard
publicstaticvoidhideKeyboard(Context context, View mView) {
InputMethodManagerimm= (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mView.getWindowToken(), 0);
}
Post a Comment for "Android Hide Keyboard"