I’ve a listView with some textView and one editText. I would save a new object when user modifies value of editText. I implemented a TextWatcher but I can’t able to retrieve a values of specific textView which referred to editText modified. Anybody help me?
EDIT
TextWatcher for specific line of listView
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);
}
}
}
}
1 Answer