title: Detect string/user input language
body: <p>I wanted to know if there is a way to detect if the user's input is in greek charset.</p>
  
  <p><strong>Edit:</strong><br>
  Just to be more clear, I need to recognize the language the user types and not the phone's locale. <br><br>For example, my phone is in English and let's say my keyboard is in Russian, the getDefault() returns "en", but I need to have "ru" at that point.<br></p>
  
  <p><br>
  I do not know if this is available out of the box from android, maybe an approach to detect the string's character codes and see if is in English alphabet or in another. Any points on this?<br><br>I imagine something like <br><code>if character belongs to K then is English</code> <br><code>(where K is the essemble of english characters)</code> </p>
  
  <p><br><strong>Solution:</strong><br></p>
  
  <p>Finally I used regular expression to determine if the string is in English.<br></p>
  
  <pre><code>String pattern = "^[A-Za-z0-9. ]+$";
  if (string.matches(pattern) 
     // is English
  else
     // is not English
  </code></pre>
  
  <p>If someone has to propose a better solution I will mark it as answer.</p>