使用给定String验证EditText的有效方法 [英] Efficient way to validate EditText with a given String

查看:84
本文介绍了使用给定String验证EditText的有效方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Coders!



我正在开发一个应用程序,在其中向用户显示一条消息,在EditText中输入什么内容。如果用户没有输入消息中显示的内容,请让他/她删除错误。例如。我想让用户输入Hello World,同时输入Hello Qorld即他/她犯了错误,这样一条消息就会出现按退格键直到他到达Q然后消息将出现哪个字符要输入下一个即W.我试过玩数组和索引并尝试完成它但不能。提示/解决方案会很棒。我急需这方面的帮助。在此先感谢。

Hi Coders!

I'm working on an app in which I show a message to user what to type in an EditText. If user doesn't input what is shown in message, make him/her remove the mistakes. E.g. lets say I want user to type "Hello World" while he types "Hello Qorld" i.e. he/she made mistake so a message is going to appear to press backspace till he reaches Q and then message is going to appear which character to type next i.e. W. I've tried playing with arrays and indexes and trying to get it done but can't. A hint/solution would be great. I need help in this regard urgent and badly. Thanks in advance.

推荐答案

你应该看一下 EditText类 [ ^ ],查看何时以及是否可以收到内容已更改的通知。此时,您可以将其输入与预期的字符串进行比较。
You should look at the methods and properties of the EditText class[^], to see when and if you can get a notification that the content has changed. At that point you can compare their typing to the expected string.


这篇关于使用给定String验证EditText的有效方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆