I have edittext in a form, I want that when the user inputs text into the edittext for my program to detect which language was inserted into the edittext.
Is there a
There's no exact way to determine what language your user is typing in unless you get really complicated, hence why the method example you've given is called isProbablyArabic
rather than isArabic
. If your users are writing exclusively in English or Farsi and nothing else, one option is to use a regex that looks to see if the user's text contains Western Roman characters ("^[a-zA-Z]*$"
), if this returns false you can assume they've typed in Persian, though it could be anything that uses a different character set.