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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -