Disable Button when Edit Text Fields empty

后端 未结 7 555
栀梦
栀梦 2020-12-31 04:22

I have two text fields and a Button. I want to disable the Button unless both EditText-Fields are not empty. I tried many solutions here at stackoverflow, but they don\'t wo

7条回答
  •  猫巷女王i
    2020-12-31 04:58

    Your problem is here:

    //set listeners
            editText1.addTextChangedListener(textWatcher);
            editText1.addTextChangedListener(textWatcher);
    

    You are not setting the textWatcher to editText2, so you are always checking the condition if you write inside editText1

提交回复
热议问题