android - Can't update data for my list view -


i'm trying add feature app can allow users edit data used populate item list view included in payments class.

whenever enter changes wish make , press accept, list view doesn't update new edited data.

below data add payments class.

    public void acceptclicked(view view)     {         failflag = false;         checkedittexts();         // if fine         if (failflag == false)         {             mosdatabase db = new mosdatabase(this);             sqlitedatabase datab = db.getwritabledatabase();             converttostring();             convertinttostring();              spaymentdate = spaymentyear + spaymentmonth + spaymentday;              contentvalues vals = new contentvalues();             vals.put("ptitle", stitle);             vals.put("pday", spaymentday);             vals.put("pmonth", spaymentmonth);             vals.put("pyear", spaymentyear);             vals.put("pa", samount);             vals.put("rmin", sremindermin);             vals.put("rhour", sreminderhour);             vals.put("rday", sreminderday);             vals.put("rmonth", sremindermonth);             vals.put("ryear", sreminderyear);             vals.put("date", spaymentdate);              if (checkbox.ischecked())             {                 createalarm();             }              if(iteminfo == false)             {                  datab.insert("paymenttable", null, vals);                 datab.close();             }              if(iteminfo == true)             {                 datab.update("paymenttable", vals, "ptitle", null);             }              intent openreminder = new intent("com.studentbudget.payments");             startactivity(openreminder);             finish();         }     } 

the convertinttostring method converts reminderday/month/year etc string versions (sreminderday/month/year etc) if i'm adding new payment otherwise uses ipaymentday, ipaymentmonth, ipaymentyear, etc.

i've tried couple of times using string[]{"ititle} last parameter in datab.update method wasn't working.

edit (27/8/13)

i've tried code posted bakrionfire, updates apart title of item.

i've tried changing 3rd parameter 'null'. allowed me edit title edited items in list view.

can tell me how update of fields item list view? solutions posted.

edit (28/8/13)

edited title. column doesn't update first column.

edit (28/8/13)

added screen shots

list view in payments activity

add payments activity

the first image shows list view on payments activity, second image shows add payments activity.

the third parameter in update filter provided updation, you've given value ptitle. not gonna match column name. trying update rows ptitle equal stitle, update should as-

datab.update("paymenttable", vals, "ptitle='"+stitle+"'", null); 

i m not sure if u want do, hope may give hint.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -