Skip to content

Instantly share code, notes, and snippets.

@hungwei0331
Created May 6, 2015 16:05
Show Gist options
  • Save hungwei0331/90bf00d0386056fdcbc3 to your computer and use it in GitHub Desktop.
Save hungwei0331/90bf00d0386056fdcbc3 to your computer and use it in GitHub Desktop.
InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
if(event.getAction() == MotionEvent.ACTION_DOWN){
if(getCurrentFocus()!=null && getCurrentFocus().getWindowToken()!=null){
imm.hideSoftInputFromWindow
(getCurrentFocus().getWindowTokeInputMethodManager.HIDE_NOT_ALWAYS);
}
}
return super.onTouchEvent(event);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment