0

currently i am trying

val inputMethodManager = activity!!.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
val ims: List<InputMethodInfo> = inputMethodManager.enabledInputMethodList
for (method in ims) {
  val inputMethodSubtype: List<InputMethodSubtype> =
    inputMethodManager.getEnabledInputMethodSubtypeList(method, true)
  for (subtype in inputMethodSubtype) {
    if (subtype.mode == "keyboard") {
      val currentLocale = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        subtype.languageTag // return empty always
      } else {
        subtype.locale
      }
      Log.d("@@", "lang-> : $currentLocale")
    }
  }
  }

it not working above Android SDK v24 and work below Android SDK v24.

Vinay
  • 732
  • 5
  • 8
  • Did you see this solution? https://stackoverflow.com/a/18733882/7761936 Maybe it works – aLT Apr 24 '20 at 20:27
  • yes, it works below Android 24. – Vinay Apr 24 '20 at 20:50
  • I guess there is no way to retrieve correct list of keyboard's input languages. Here you can find the same question and conversation. Hopefully, It will help you https://stackoverflow.com/questions/35534958/android-get-available-input-languages – aLT Apr 25 '20 at 01:30

0 Answers0