android - How to Store value for EditText in Session -


in cart activity, allowing user edit quantity of item, , getting changes in total amount user change in quantity, here facing small problem, whenever click on button, reset quantity, why?

please see below screen shot:

![enter image description here][1]

for example, in above screen have edited quantity product veggie 1 15 , getting change in total, problem once click on button, again value quantity 1 not 15, have entered earlier

please tell me how can control on ?

cartadapter.java:

    if(cost.gettext().length() > 0)     {         try         {            itemamount = double.parsedouble(cost.gettext().tostring());            log.d("productinformationactivity", "itemamount :: " + itemamount);         }         catch(numberformatexception e)         {             itemamount=0.00;             log.d("productinformationactivity", "numberformatexception :: " + e);         }     }      qty.addtextchangedlistener(new textwatcher() {          public void ontextchanged(charsequence s, int start, int before,                 int count) {              if (!qty.gettext().tostring().equals("")                     || !qty.gettext().tostring().equals("")) {                  // accept quantity user                 itemquantity = integer.parseint(qty.gettext()                         .tostring());                  total.settext(new decimalformat("##.#").format(itemamount*itemquantity));              }          }          @override         public void aftertextchanged(editable s) {          }          @override         public void beforetextchanged(charsequence s, int start, int count,                 int after) {          }          });      return vi;       }          } 

why don't save values , populate them in oncreate()? can use of 3 mechanisms want.

  1. shared preferences
  2. sqlite db
  3. application

Comments