开发者

"The type Main must implement the inherited abstract method TextWatcher.beforeTextChanged(charSequence,int,int,int)

I'm trying to add a TextWatcher editbox.afterTextChanged listenering to my "Main" activity where I have already used an onFocusListener. I receive this error message on the line where I declare the Main class:

public class Main extends Activity implements OnFocusChangeListener, TextWatcher{

the listener is set to an edittext box with:

etBox1.addTextChangedListener(this);

and the code to implement with the catch is:开发者_如何学运维

public void afterTextChanged(Editable s) { doMyCalcs(); }

Any idea where I went wrong?


You implement all three methods in TextWatcher.

public void afterTextChanged(Editable s) { ... }
public void beforeTextChanged(CharSequence s, int start, int count, int after) { ... }
public void onTextChanged(CharSequence s, int start, int before, int count) { ... }

You only implemented the first one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜