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,002
  • 13
  • 52
  • 74

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
  • 2,057
  • 10
  • 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,646
  • 2
  • 34
  • 84
-2

Use this proof statement:

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