删除ParseObject匹配查询

时间:2014-06-08 05:17:52

标签: android parse-platform

我想删除与某个查询匹配的ParseObject。目前我首先使用查询检索对象,然后在done()方法中删除它。这似乎浪费了网络电话。有没有办法在一次调用中执行此操作而不检索对象?

        String currentUsername = ParseUser.getCurrentUser().getUsername();
        String friendUsername  = friendList.get(userPosition).getUsername();
        ParseQuery<ParseObject> pQuery = ParseQuery.getQuery("UserFriends");
        pQuery.whereEqualTo("username"  , friendUsername);
        pQuery.whereEqualTo("Fusername" , currentUsername); 
        pQuery.getFirstInBackground(new GetCallback<ParseObject>() 
        {

            @Override
            public void done(ParseObject object, ParseException e) 
            {
                if(object!=null)
                {
                    Log.i(TAG,"Object not null");
                    object.deleteEventually();
                }else
                {
                    Log.i(TAG,"Error Deleting");
                    Log.i(TAG,"Error Deleting:"+Integer.toString(e.getCode()));
                    Log.i(TAG,"Error Deleting:"+e.getMessage());
                }
            }
        });

0 个答案:

没有答案