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
Post a Comment