parse.com - No success in deleting a specific row from parse in android -
i'm trying delete specific row parse table, i'm getting object parse table , adding arraylist, when i'm clicking on list view i'm first checking if value 1 clicked on right one,thats ok , when i'm trying delete specific row it's deleting last row i'm doing wrong?
here code
parsequery<parseobject> query = parsequery.getquery("smstable"); (int = 0; <cm.mlist.size() ; i++) { query.whereequalto("objectid", cm.mlist.get(i)); } query.findinbackground(new findcallback<parseobject>() { public void done(list<parseobject> objects, parseexception e) { if (e == null) { // iterate on messages , delete them (parseobject smsobject : objects) { smsobject.deleteinbackground(); } } else { //handle condition here } } });
a query supports 1 constraint of type per field. you're doing in loop overwrites whatever have set in previous iteration of loop.
if want query multiple ids, use wherecontainedin
constraint , pass in objectids list.
so instead of loop, should work:
query.wherecontainedin("objectid", {your_list_of_ids})
there example in documentation query constraints.
Comments
Post a Comment