我有2個edittext,我想設置第二個edittext爲0,並使其失效,如果第一個edittext的值低於10.我使用TextWatcher但運行時出現堆棧溢出錯誤。誰能幫我這個 ?? 我的代碼如下:EditText上的TextWatcher Android
qteDev = (EditText) findViewById(R.id.edt_qtedev);
qte = (EditText) findViewById(R.id.edt_qte);
qte.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
if(qte.getText().toString().equals(""))
return ;
int l = qte.getText().length();
if (l == 1) {
qteDev.setText("0");
qteDev.setClickable(false);
qteDev.setEnabled(false);
qteDev.setActivated(false);
}
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// TODO Auto-generated method stub
}
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
請發佈錯誤(log-cat) – Bigflow