Rashid.a
Rashid.a

Reputation:

how to keep checking if the EditText are empty (if empty button is enabled else is disabled) : android/java

I have two EditText fields, and one button.

i want to do the following:

if the EditText1 && EditText2 == empty
   then
      button is disabled
     else
      button is disabled 

the button should be enabled only if the user write something in both fields,

in simple words:

       if the user write something in both fields, the button will be enabeld, 

if he delete what he write then disable the button again.

i will be regretful if any one answer me.

android 2.2.

Upvotes: 0

Views: 133

Answers (1)

codeMagic
codeMagic

Reputation: 44571

You want TextWatcher. Use this to determine when text is changed in both. You could either do an 'if else' every time text is changed or in a while loop. Hope this helps. And I think you will be grateful not regretful for help :)

Upvotes: 1

Related Questions