Android examples for User Interface:EditText
set Text Changed Button Enable between EditText and Button View
//package com.java2s; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.widget.EditText; import java.util.List; public class Main { public static void setTextChangedButtonEnable( final List<EditText> list, final View button) { for (int i = 0; i < list.size(); i++) { EditText editText = list.get(i); editText.addTextChangedListener(new TextWatcher() { @Override/*w w w.jav a 2 s . c om*/ public void onTextChanged(CharSequence s, int start, int before, int count) { for (int i = 0; i < list.size(); i++) { EditText editText = list.get(i); if (editText.getText().toString().length() == 0) { button.setEnabled(false); break; } else { button.setEnabled(true); } } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub } }); } } }