填充 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 (将#修改为@)