Android 循环EditText addTextchangedListener

Android 循环EditText addTextchangedListener,android,Android,我正在尝试通过循环初始化addTextchangedListener。在我的应用程序中,用户必须输入From(%)值,而to(%)将以编程方式创建 +-------------+-------+--------+ | Equivalents | To(%) | From(%)| +-------------+-------+--------+ | 1.00 | 100 | 99 | -------------------------------- | 1.25

我正在尝试通过循环初始化addTextchangedListener。在我的应用程序中,用户必须输入From(%)值,而to(%)将以编程方式创建

+-------------+-------+--------+
| Equivalents | To(%) | From(%)|
+-------------+-------+--------+
|   1.00      | 100   |  99    |
--------------------------------
|   1.25      | 98    |  95    |
这是我的密码:

to[0].setText("100");

 for(j=0;j<8;j++){
                         from[j].addTextChangedListener(new TextWatcher(){
                                public void afterTextChanged(Editable s) {

                                    String checkrf= (from[j].getText().toString());
                                    if(checkrf.equals("")){
                                        j=j+1;
                                         to[j].setText("");
                                    }
                                    else{
                                    int rt = Integer.parseInt( to[j].getText().toString() );    

                                    int rf = Integer.parseInt( from[j].getText().toString() );
                                    if(rt>rf){ 
                                    rf= rf-1;
                                     j=j+1;
                                     to[j].setText(""+rf);
                                    }

                                    else{
                                        Toast.makeText(getApplicationContext(),"From(%) should is Smaller than To(%)",
                                                Toast.LENGTH_SHORT).show();
                                        from[j].setText("");
                                        }
                                    }
                                }
                                public void beforeTextChanged(CharSequence s, int start, int count, int after){}
                                public void onTextChanged(CharSequence s, int start, int before, int count){}

                                }); 
                }
到[0].setText(“100”);
对于(j=0;jrf){
rf=rf-1;
j=j+1;
至[j].setText(“+rf”);
}
否则{
Toast.makeText(getApplicationContext(),“From(%)应小于To(%)”,
吐司。长度(短)。show();
from[j].setText(“”);
}
}
}
public void beforeTextChanged(字符序列s、int start、int count、int after){}
public void onTextChanged(字符序列,int start,int before,int count){}
}); 
}

但是,我的代码什么也不做。我尝试在不使用循环的情况下实现它,效果很好。任何帮助都将不胜感激

你到底想创造什么?那上面的表格模式?我正试图在我的界面上创建它。但不是在我的数据库表上。