Skip to content

Instantly share code, notes, and snippets.

@v3n3
Created May 9, 2017 21:18
Show Gist options
  • Select an option

  • Save v3n3/7e9b993fbb796bac56db3a71d1611b48 to your computer and use it in GitHub Desktop.

Select an option

Save v3n3/7e9b993fbb796bac56db3a71d1611b48 to your computer and use it in GitHub Desktop.
@android.databinding.BindingAdapter("showKeyboard")
public static void showKeyBoard(final EditText editText, final boolean showFlag) {
editText.post(new Runnable() {
@Override
public void run() {
if (showFlag) {
KeyboardUtils.showKeyboard(editText);
} else {
editText.clearFocus();
+ KeyboardUtils.hideKeyboard(editText.getContext(), editText);
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment