I want to detect if my edittext
has English characters and notify user to change it because i want just Persian characters for name and family name. how can i filter edittext
to accept just Persian characters or detect English characters and show an error?
I think its not easy to detect and inform user to instruct. Simply u can do something like this. In XML file:
<EditText
android:id="@+id/LanguageText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="text"
android:digits="@string/app_lan" />
In Strings.xml :
<string name="app_lan">YOUR LANGUAGE</string>
Example If English :
<string name="app_lan">abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>
For ur language same like this.
Persian characters are within the range: [\u0600-\u06FF]
. Validate your string with regex.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With