In my application, in an activity i have 4 edit Text fields and a button. Only After entering data for all 4 edit text fields, data will be submitted. If one is empty, i am showing an alert dialog stating my custom error message. Now in the activity if i click on edit text and press any key on keyboard, the text is not appened to edit text.
If you have faced a similar issue please do let me know.enter code here
<EditText
android:id="@+id/first_field"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/TextView01"
android:layout_centerHorizontal="true"
android:layout_marginBottom="6dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'."
android:gravity="left|center"
android:hint="First Name"
android:imeOptions="actionNext"
android:inputType="text"
android:textSize="11sp"
android:typeface="sans" >
</EditText>
In .java File
in Oncreate Method
first_field = (EditText)findViewById(R.id.first_field);
InputFilter[] filter = new InputFilter[1];
filter[0] = new InputFilter.LengthFilter(24);
first_field.setFilters(filter);
in Onclick event for the button
NumberKeyListener keyListener1 = new NumberKeyListener() {
public int getInputType() {
return InputType.TYPE_CLASS_TEXT;
}
@Override
protected char[] getAcceptedChars() {
return new char[] { '.','‘' };
}
};
first_field.setKeyListener(keyListener1);
I commented this part of the code in Onclick method and it worked fine.