TextChangedListener Android

TextWatcher

You can do the addTextChangedListener() method one time.

 TextChangedListener Android

First step

implements TextWatcher

Then you have a error
add unimplemented method


	@Override
	public void afterTextChanged(Editable s) {

	}

	@Override
	public void beforeTextChanged(CharSequence s, int start, int count,
			int after) {

	}

	@Override
	public void onTextChanged(CharSequence s, int start, int before, int count) {

	}

Now you can need declare you editText and to add listener in onCreate()

public class MainActivity extends ActionBarActivity implements OnClickListener,TextWatcher {

	EditText mEditText;
	Button mButtonSave;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		mButtonSave = (Button) findViewById(R.id.activity_main_button_save);
		mEditText = (EditText) findViewById(R.id.activity_main_editText1);

		mEditText.setOnClickListener(this);

		mButtonSave.setEnabled(false);
		mEditText.addTextChangedListener(this);
	}

	@Override
	public void afterTextChanged(Editable s) {

	}

	@Override
	public void beforeTextChanged(CharSequence s, int start, int count,
			int after) {

	}

	@Override
	public void onTextChanged(CharSequence s, int start, int before, int count) {
		if (mEditText.getText().length() == 0) {
			mButtonSave.setEnabled(false);
		}else{
			mButtonSave.setEnabled(true);
		}
	}

}

Donwload code