I have an Edittext in my android application. I don't want to allow user to enter first space character..but after entering other charecter user can enter space also..I used
<EditText
android:id="@+id/editText1_in_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="text"
android:digits="_,qwertzuiopasdfghjklyxcvbnm,QWERTYUIOPASDFGHJKLZXCVBNM,0123456789">
but in this case user can not enter space.
I have also used Text Watcher but I need not to allow user at the time of entering text as android:digits works.
Using InputFilter easy to handle enter first white space character ignore
First setFilters() method on editText
Make InputFilter
No need to write android:digits property on XML
remove this line
and remove this property from your EditText
This code works exactly according to your needs.
Use this. If the character at starting Position is a space, set textView Text To blank
This works for me
If you want to filter input characters in your EditText, you need to use InputFilter. Here is example. //Allow only letters or digits
For details look here