【发布时间】:2013-05-30 07:19:24
【问题描述】:
示例:我有一个 EditText 和 1 个按钮(onclick:示例)。我想检查在 EditText 中输入的第一个单词。
public void example (View v) {
if (edittext.getText().toString() .... //How to check the first word that typed in edittext,
ex: if the first word typed in edittext equalsIgnoreCase("a")){
//Action
}
【问题讨论】:
-
您可以使用 TextWatcher,而不是单击按钮。
-
这个问题已经有人问过了。你可以在这里查看:stackoverflow.com/questions/5067942/…
-
你必须使用 onTextChanged 事件stackoverflow.com/a/6003815/1584654
-
只是想找到最简单的方法
标签: android if-statement