It looks like you're using the edit control for both: displaying prompts and getting the value.

An easy fix is to only use the edit control for getting the value, and display prompts some other way: by using a toast or a separate TextView next to the EditControl.

-- Kostya

14.10.2010 1:43, chcat пишет:
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?

         }
});



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
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

Reply via email to