android - Validate text input by comparing it to an array of strings -


i want able take users input text field , compare if exists in string array. simple right such asking user "spell dog" , use input text in text field , once done compares word dog. can preset them or use inbuilt dictionary, research says use editview , change there, cannot think of anyway , other example found not quite answer it. thank in advance.

maybe can you: can use hash

    hashmap<string,string> mdata;     mdata.put("dog","...");     ...     edittext1.addtextchangedlistener(new textwatcher() {             @override            public void aftertextchanged(editable s) {            if (mdata.containskey(edittext1.gettext().tostring()))              // success code            }             @override            public void ontextchanged(charsequence s, int start, int before, int count) {             }             @override                public void beforetextchanged(charsequence s, int start,              int count, int after) {            }        }); 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -