-1

I need to know How I can detect the language of a text entered by a user in an editText in android.

I search about all the available tries to solve this issue, especially in this link, How to detect language of user entered text? but that was not applicable because the app gets crashed before it's started.

I also tried "locale" but this didn't work because it specifies the language of the device, not the text written in an edit text.

Is there any solution? could you help me?

Community
  • 1
  • 1

1 Answers1

4

Try this

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

    InputMethodSubtype ims = imm.getCurrentInputMethodSubtype();

    String locale = ims.getLocale();
Mohamed AbdelraZek
  • 2,503
  • 4
  • 25
  • 36