Why do you have a loop anyway? You can check the password in onTextChanged method and do whatever you want.
On Oct 14, 2:43 am, chcat <[email protected]> wrote: > Hi all, > I am trying to implement simple user input validation in EditText, > something like > > setText("type your password:") > ... > if ( user input != "secretword") > > setText("incorrect, try again: ") > > So i am using "onTextChanged" to validate keyboard input, but how can > i set the text without going to infinite loop? > Thank you, > -V > > EditText tv = new EditText(this); > tv.setText("type password >>"); > tv.addTextChangedListener(new TextWatcher() { > public void afterTextChanged(Editable s) { > //XXX do something > } > public void beforeTextChanged(CharSequence s, int start, int > count, > int after) { > Log.w("before text changed: ", s.toString()); > } > public void onTextChanged(CharSequence s, int start, int > before, int count) { > //validate here and do what? > > } > > }); > > -- 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

