私はいくつかのtextViewと1つのeditTextを持つlistViewを持っています。ユーザーが editText の値を変更すると、新しいオブジェクトが保存されます。TextWatcher を実装しましたが、変更された editText を参照する特定の textView の値を取得できません。誰か助けて?
編集
listView の特定の行の TextWatcher
quantity.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
if(!s.toString().isEmpty()){
if (Integer.parseInt(s.toString())!=0){
HashMap<Products, Integer> into = new HashMap<Products, Integer>();
Products pr = new Products();
//product contains value of textView
pr.set_id(Integer.parseInt(product.get("id")));
pr.setNome(product.get("nome"));
into.put(pr, Integer.parseInt(s.toString()));
pArrayList.add(into);
cart.setProdotti(pArrayList);
}
}
}
}