List of usage examples for android.view.inputmethod InputMethodManager getCurrentInputMethodSubtype
public InputMethodSubtype getCurrentInputMethodSubtype()
From source file:Main.java
public static String getLocale(final Context context) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodSubtype ims = imm.getCurrentInputMethodSubtype(); return ims == null ? "" : ims.getLocale(); }
From source file:com.android.screenspeak.eventprocessor.ProcessorPhoneticLetters.java
/** * Handle an event that indicates a key is held on the soft keyboard. *///w w w . j a v a 2 s .c om private void processKeyboardKeyEvent(AccessibilityEvent event) { final CharSequence text = AccessibilityEventUtils.getEventTextOrDescription(event); if (TextUtils.isEmpty(text)) { return; } String localeString = FALLBACK_LOCALE; InputMethodManager inputMethodManager = (InputMethodManager) mService .getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodSubtype inputMethod = inputMethodManager.getCurrentInputMethodSubtype(); if (inputMethod != null) { localeString = inputMethod.getLocale(); } String phoneticLetter = getPhoneticLetter(localeString, text.toString()); if (phoneticLetter != null) { postPhoneticLetterRunnable(phoneticLetter); } }