How can I learn the keyboard language? (O / FR)

I am developing an sms sender application and I want to know the language that the user uses. therefore, when a user enters a message, how can I find out the language that he / she uses?

+6
source share
3 answers

get input type manager using:

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 

then choose what to get from it using the following methods:

http://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#getCurrentInputMethodSubtype%28%29

or: http://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#getLastInputMethodSubtype ()

along with this, to get the input type locale:

http://developer.android.com/reference/android/view/inputmethod/InputMethodSubtype.html#getLocale ()

+10
source

You can get the keyboard language by first defining the keyboard language of the device, and then getting the Locale object from it. For instance,

  InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodSubtype ims = imm.getCurrentInputMethodSubtype(); String localeString = ims.getLocale(); Locale locale = new Locale(localeString); String currentLanguage = locale.getDisplayLanguage(); 

Here, currentLanguage will provide you with the language of your keyboard. Hope this helps.

+4
source

Unable to get current keyboard language. Android does not allow retrieving the currently configured language, the API does not exist.

0
source

All Articles