Skip to content

Instantly share code, notes, and snippets.

@marcosalis
Last active February 21, 2018 14:51
Show Gist options
  • Save marcosalis/ddeffd99a202077fced5981cfc4ad15c to your computer and use it in GitHub Desktop.
Save marcosalis/ddeffd99a202077fced5981cfc4ad15c to your computer and use it in GitHub Desktop.
Android: Detect if Samsung keyboard is the current selected input
try {
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
Field field = imm.getClass().getDeclaredField("mCurId");
field.setAccessible(true);
String o = (String) field.get(imm);
if ("com.sec.android.inputmethod/.SamsungKeypad".equals(o)) {
isSamsungKeyboard = true;
}
} catch (Exception ignored) { // we failed
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment