No success in deleting a specific row from parse in android

I'm trying to delete a specific row from parse table, I'm getting the object from parse table and adding it to arrayList, When i'm clicking on the list view i'm first checking if the value for the one that i clicked on is the right one,thats ok and when i'm trying to delete the specific row it's always deleting the last row what I'm doing wrong?

here is my code

ParseQuery<ParseObject> query = ParseQuery.getQuery("SmsTable"); for (int i = 0; i <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 over all messages and delete them for (ParseObject smsObject : objects) { smsObject.deleteInBackground(); } } else { //Handle condition here } } });

-------------Problems Reply------------

A query only supports one constraint of a type per field. What you're currently doing in the loop basically overwrites whatever you have set in the previous iteration of the loop.

If you want to query for multiple IDs, use the whereContainedIn constraint and pass in the objectIds as a list.

So instead of your loop, this should work:

query.whereContainedIn("objectId", {YOUR_LIST_OF_IDS})

There is also an example in the documentation for Query Constraints.

You cannot access objectId attribute in Parse. If you call object.get("objectId"); you will get null, this forces you to use object.getObjectId().

This is probably the reason why query.whereEqualTo("objectId", cm.mList.get(i)); nor query.whereContainedIn("objectId", {YOUR_LIST_OF_IDS}) would not return anything. If you want to delete several objects from list of ids, the best way would be

List<ParseObject> objects = new ArrayList<>();

for (String id : cm.mList) {
ParseObject object = ParseObject.createWithoutData("SmsTable", id);


Category:android Views:4 Time:2019-03-12

Related post

  • Android SQLite deleting a specific row from database 2013-02-22

    i am trying to do a simple login page where i am able to delete a specific contact with its details just by entering the username. in other words, i would like to delete a specific row in my database. public int deleteUsername(String content){ String

  • MySql - How to auto delete a specific row from table 2013-06-01

    In my website user can choose how long his post can display in home page, after a certain time I want to delete that post automatically. By using Event scheduler in MySql, I could only able to delete a couple of records which are stored more than the

  • delete a specific item from listview stored in database in android application 2011-11-12

    I am making an android application in which i have five items in a list .On each item click data is coming from url and then i have stored the items in local database.Now i want to have delete button before each item so that user can delete the item

  • how to delete specific colums of a particular row from SQLIte in Android 2011-01-27

    Hi I need to write a query to delete specific colums of a particular row from SQLIte in Android.I want to use it in the form of "db.delete (String table, String whereClause, String[] whereArgs)". Actually my application contains 4 columns for each ro

  • delete specific row from database 2010-01-31

    I`am trying to delete a specific row in database. i am deleteing by using this query: Uri myUri = Uri.parse("content://com.idan.datastorageprovider/maps"); this.getContentResolver().delete(myUri, "ROUTE_NAME="+routeName,null); in my database i have 2

  • Linq to entity delete a specific column from a table 2011-12-13

    Linq to entity query to delete a specific column from a table by matching a condition ` public ActionResult deleteChecks(string checkValue) { check_master checks = (from table in db.check_master where table.check_code == checkValue select table).Firs

  • Download specific rows from database as csv file in struts 2012-03-20

    I need Java code for for downloading specific rows from database, in CSV format. I'm using the Netbeans IDE and Structs. I used the following code in my action class: else if (mode.equalsIgnoreCase("download")) { if(null !=request.getParameter("batch

  • Delete only 500 rows from a table 2009-05-03

    Can somebody please, help me with a query to delete only 500 rows from a table which has 20000 rows. Also has to be older than a particular date. Thanks for your help, Soofy --------------Solutions------------- You can use the Top keyword like you wo

  • How to get cell data of specific row from the dynamically created HTML table? 2010-09-25

    How to get cell data of a specific row from the dynamically created HTML table in JSP? I am creating JSP Page in the following way Connect to MySQL Databse Fetch rows from table based on criteria Construct HTML table dybamically based on the rows ret

  • Putting A Specific Row From Linq Result On Top? 2010-09-28

    Let's say I have a linq query like the one below var LinqResult = from a in Db.Table select new {Table = a}; From here, how can I grab a specific row from these results and put it on top? --------------Solutions------------- orderby (a.Id == someId ?

  • MySQL - Deleting Some Specific Tables From Big Database 2011-05-13

    How can we delete some specific tables from a database. For instance I have a database with more than 20.000 tables and I need to delete the one which contains some specific strings in their names. So how can I do it? Is there a way to get the all ta

  • How to delete a specific line from binary file? 2011-12-01

    How to delete a specific data from binary file. Please example, thanks :) --------------Solutions------------- Binary files have no lines, but to delete any block of data from any file you just need to write the data after this block starting at this

  • Delete number of rows from table Transact-SQL 2012-02-09

    In general it's necessary to delete about 110K rows from table Nodes but their id are not declared explicitly but are given from another table. DECLARE @gh Table(id int); INSERT INTO @gh (id) SELECT node_id FROM Relations; DELETE FROM Nodes WHERE id

  • Copy specific rows from each worksheets based on condition 2013-05-29

    Hi, I want to copy specific rows from each worksheets (about 12-13 worksheets) to Summary sheet (sheet 2) in my workbook. The sheet 2 is Summary sheet for other sheets in the same workbook. In each worksheet, there is "Task" field and in this Task fi

  • Deleting specific rows from DataTable 2011-04-13

    I want to delete some rows from DataTable, but it gives an error like this... Collection was modified; enumeration operation might not execute i use for deleting this code foreach(DataRow dr in dtPerson.Rows) { if(dr["name"].ToString()=="Joe") dr.Del

  • Deleting specific rows from a data frame 2011-07-06

    I am working with some US govt data which has a lengthy list of cities and zip codes. After some work, the data is in the following format. dat1 = data.frame(keyword=c("Bremen", "Brent", "Centreville, AL", "Chelsea, AL", "Bailytown, Alabama", "Calera

  • How to delete specific rows from multiple csv files in powershell? 2015-02-04

    Hello I'm looking for a effective way to delete second and last row from multiple csv files? I have around 5000 files in a directory. The code below will delete first line. If I use parameter -skip 2. It will skip first 2 rows, but I need to keep fir

  • Copy specific rows from multiple sheets to single sheets automatically. 2012-07-09

    I have multiple sheets in single work book with almost identical columns with varied number of rows in each sheet. Sheet 1 Serial # name Grade Fulltime Job Age Notes 1 ABC1 A Y Plumber 55 XXXXX 2 ABC2 B Electrician 26 YYYYY 3 ABC3 C Carpenter 56 AAAA

  • Macro delete only 3 rows from the entire worksheet with given choice 2012-09-08

    Hi, i have a macro that delets and entire row of your choice by input box. Could it be possible that the same macro can be used but only deletes 3 cells with you given choice and the 3 cells deletes by Shift xl up. The macro i have is written below:

  • Problem; cannot delete a specific email from my win live email account. 2013-01-18

    I cannot delete a specific email in windows live mail. It is spam using the BCC trick to reach my account, even though addressed to some other charter address. I can and have deleted it from my charter email account. It still appears in W

  • linq to sql and retrieving only specific rows from joined tables 2009-01-20

    I have two tables 1) Product 2) Categories Product table has a field called "CategoryID" and the Category table has a field called "CategoryName", ID, DateCreated, and a few others. I want to use LINQ to SQL to query all the Product rows as well as J

  • php return a specific row from query 2009-11-09

    Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I've found return a 2 dimensional array to access specific rows. I want to be able to return only 1 specific row, kinda like mysql_result...

  • selecting specific rows from database in sql 2011-07-12

    Possible Duplicate: How to select the nth row in a SQL database table? I have a table that I want to select Select 1 record and in other command I want to select second row and in other command 3th row and ... how can I select for example 4th record

  • Why a 404 error for editurl: 'clientData' when deleting a second row from jqGrid? 2011-08-01

    Referring to a slightly modified version of a jqGrid local editing demo by user @Oleg located here: ...after one row is deleted using either the rubbish bin icon in the lower toolbar or the Delete button on

  • Removing specific rows from a dataframe 2011-08-18

    I have a data frame e.g.: sub day 1 1 1 2 1 3 1 4 2 1 2 2 2 3 2 4 3 1 3 2 3 3 3 4 and I would like to remove specific rows that can be identified by the combination of sub and day. For example say I wanted to remove rows where sub='1' and day='2' and

Copyright (C), All Rights Reserved.

processed in 0.262 (s). 11 q(s)