如何解决填充 OnTextWatcher 后,ArrayList 变空
我正在用edittext中写的内容填充arraylist。为此,我使用了 TextWatcher
tempMeasure1 = ""; //----------------------------- TemporyText
Measure1.add(position,tempMeasure1); //--------------------- ArrayList that need to be filled. adding object here so that it can be later updated
edit1.addTextChangedListener(new TextWatcher()
{
@Override
public void beforeTextChanged(CharSequence s,int start,int count,int after)
{
}
@Override
public void onTextChanged(CharSequence s,int before,int count)
{
tempMeasure1 = s.toString();
Log.i("tempMeasure1:",tempMeasure1); //---------------- Here I can get the value
Measure1.set(position,tempMeasure1);
Log.i("tempMeasure1InList:",Measure1.get(position)); //------------ Here also I can get the value
}
@Override
public void afterTextChanged(Editable s)
{
}
});
但是当我尝试从 TextWatcher 中获取 ArrayList 中的值时,我得到了 null。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。