tags:

views:

372

answers:

2

friends,

can any one guide me how can i enter only alphabets in EditText in android?

any help would be appriciated.

A: 

Try This

<EditText
  android:id="@+id/EditText1"
  android:text=""
  **android:inputType="text|textNoSuggestions"**
  android:textSize="18sp"
  android:layout_width="80px"
  android:layout_height="43px">
</EditText>

Other inputType can be found Here ..

Vinayak.B
in case of text it accepts every thing...
UMMA
A: 
EditText state = (EditText) findViewById(R.id.txtState);


                Pattern ps = Pattern.compile("^[a-zA-Z ]+$");
                Matcher ms = ps.matcher(state.getText().toString());
                boolean bs = ms.matches();
                if (bs == false) {
                    if (ErrorMessage.contains("invalid"))
                        ErrorMessage = ErrorMessage + "state,";
                    else
                        ErrorMessage = ErrorMessage + "invalid state,";

                }
UMMA
using regular expression.
UMMA