EditText添加内容改变的监听器

mEditText.addTextChangedListener(new TextWatcher() {
    //EditText中文本内容改变的时候自动调用的方法
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        //这个CharSequence就是当前的文本输入框中的内容
        String address  = AddressDao.getAddress(s.toString());
        tv.setText(address);
    }

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

    }

    public void afterTextChanged(Editable s) {

    }
});

 

posted on 2015-04-29 09:47  道无涯  阅读(723)  评论(0编辑  收藏  举报