I have an edittext in my activity and users can type only letters. I want to check if user types something else not letter. How can i do that?
I've tried using onKeyListener but i think that's the wrong way to do that because you have to write so much "else if" blocks for every other keys which are not letters.
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:inputType="textMultiLine"
android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz">
</EditText>
For example, when user clicks space i want to show him an alert dialog that says "you can type only letters!". or clicks numbers or clicks slash.