Perhaps something like
EditText et = new EditText(myContext);
et.addTextChangedListener(new TextWatcher() {
String mystring;
private boolean myFilterOK(CharSequence s) {
char c;
for ( int i = 0; i < s.length(); i ++ ) {
c = s.charAt(i);
if (!(( c>='a' && c<='z' ) || ( c>='A' && c<='Z') ||
c==' ')) return false;
}
return true;
}
public void afterTextChanged(Editable s) { }
public void beforeTextChanged(CharSequence s, int start, int
count, int after) { mystring = s.toString(); }
public void onTextChanged(CharSequence s, int start, int
before, int count) {
if(!myFilterOK(s)) {
et.setText(mystring);
et.setSelection(start);
}
}
});
(I did not verify correct functionality here)
Regards
On May 25, 9:36 pm, guruk <[email protected]> wrote:
> Thanks Dianne,
>
> please can you give me a small example.. HOW??
> I am near to give up. I tried so much.
>
> >>EditText dapikeyfield = (EditText) apiEntryView.findViewById
> >>(R.id.api_edit);
> >>dapikeyfield.setKeyListener(DigitsKeyListener.getInstance("
> >>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"));
>
> works, but i softkeypad starts with numeric keyboard, could i change
> that to alphabetic with my code above.. would be great.. just with the
> Api iam lost.
>
> or please (its just the last step to release my app) give me -please-
> a small example for my EditText "dapikeyfield" !
>
> Thanks a lot
>
> Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---