Android: How to enable my button back if EditText is not empty?

自闭症网瘾萝莉.ら 提交于 2019-12-01 09:01:58

You're correct about needing a TextWatcher. The afterTextChanged(Editable) method is the one you're interested in for something like this. Call your buttonEnable() method from it, and add the TextWatcher to any applicable text fields. (Looks like feedback and email from your sample.)

viv

One easy way can also be to set onKeyListener to your editText(), then if there is something in editText(), set button enable if nothing disable it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!