第一步:
if (holder.mEtInputsTime.getTag() != null && holder.mEtInputsTime.getTag() instanceof TextWatcher) {
holder.mEtInputsTime.removeTextChangedListener((TextWatcher) holder.mEtInputsTime.getTag());
}
第二步:
holder.mEtInputsTime.setText(schemeBean.getSafetyInterval());
TextWatcher intervalTextWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
mDatas.get(position).setSafetyInterval(s.toString());
}
};
第三步:
holder.mEtInputsTime.addTextChangedListener(intervalTextWatcher);
第四部
holder.mEtInputsTime.setTag(textWatcher);
网友评论