How to use different variable or array for different Listview items in Android? -


i trying make e-commerce app. when click on add "+" sign, quantity , sub-total calculated on basis of price.please assist me in re-initializing variable each item of listview. working fine first item.

enter image description here

enter image description here

i resolved this. not satisfied. can improve using list or array???

add.setonclicklistener(new view.onclicklistener() {                 @override                 public void onclick(view view) {                     string q= (string) quantity.gettext();                     double d = double.parsedouble(q);                     qty=d;                     qty++;                      double sub_total =currentitem.getprice();                        item_sub_total = qty*sub_total;                     quantity.settext(string.valueof(qty));                     subtotal.settext(string.valueof(item_sub_total));                 }             }); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -