我已經創建了一個默認值爲1的EditText「quantity」。我想在用戶編輯它之後獲取EditText的「quantity」的最終值,而不是給我默認值(= 1)。如何獲取EditText在用戶編輯後的值?
我怎麼能從這裏做到這一點?
EditText quantity = (EditText)findViewById(R.id.quantity);
final int qty = Integer.valueOf(quantity.getText().toString()).intValue();
quantity.addTextChangedListener(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) {
}
});
GET值(..)更新值' – Rustam