1

I want to detect whether the keyboard input method/language is Arabic, and I want to use it in my Conditional Block. Like this

if(Keyboard input method/language is Arabic)
{
  //do something
}

keep in mind I just want to detect whether the keyboard input method/language is Arabic, rest of the code I will write myself.

Thanks

Manuel Allenspach
  • 12,467
  • 14
  • 54
  • 76

3 Answers3

0

You can get Input Language as follows:

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();
Rajan Bhavsar
  • 1,977
  • 11
  • 25
0
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();

if(Keyboard input method.equals(currentLanguage)
    {
      //do something
    }
Santhucool
  • 1,656
  • 2
  • 36
  • 92
-2

Use this proof statement:

if(Locale.getDefault().getLanguage().equals("ar")){
    //do something
}
Gabriella Angelova
  • 2,985
  • 1
  • 17
  • 30