android - Using edittext as a word checker -
so i'm new world of java & android coding coding. want make code checker checks if code entered correct. if gives message "code verified".
so example, enter 'test', should accepted. when compile code doesn't work.
here current code
sub button1_click if promocode.text="test" msgbox("code verified") else msgbox("that code incorrect") end if promocode.text="" end sub
from top of head, should work:
button button1 = (button) findviewbyid(r.id."the id of button"); edittext promocode = (edittext) findviewbyid(r.id."the id of textbox"); button1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if(promocode.gettext == "test"){ toast toast = toast.maketext(getapplicationcontext(), "code verified", toast.length_short); toast.show(); }else{ toast toast = toast.maketext(getapplicationcontext(), "that code incorrect", toast.length_short); toast.show(); }; promocode.settext = ""; } });
Comments
Post a Comment