Android 取消BinalLinBackground(List<;…>;,DeleteCallback)后仍在localstore中的对象
我在Android应用程序中使用Parse.com。我正在制作一个协作购物列表,它允许用户标记要删除的项目(它们变为灰色),但只有当我按下同步按钮(并且有可用的网络)时,它们才会被实际删除。目前,这些对象是从parse数据库中删除的,而不是从本地数据存储中删除的。我正在尝试这个:Android 取消BinalLinBackground(List<;…>;,DeleteCallback)后仍在localstore中的对象,android,parse-platform,local-datastore,Android,Parse Platform,Local Datastore,我在Android应用程序中使用Parse.com。我正在制作一个协作购物列表,它允许用户标记要删除的项目(它们变为灰色),但只有当我按下同步按钮(并且有可用的网络)时,它们才会被实际删除。目前,这些对象是从parse数据库中删除的,而不是从本地数据存储中删除的。我正在尝试这个: ParseQuery<ShoppingItem> queryDeletes = ShoppingItem.getQuery(); queryDeletes.fromPin(MyApplicatio
ParseQuery<ShoppingItem> queryDeletes = ShoppingItem.getQuery();
queryDeletes.fromPin(MyApplication.ALL_ITEMS);
queryDeletes.whereEqualTo("isDeleted", true);
queryDeletes.findInBackground(new FindCallback<ShoppingItem>() {
@Override
public void done(final List<ShoppingItem> items, ParseException e) {
if (e == null) {
ShoppingItem.deleteAllInBackground(items, new DeleteCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
ShoppingItem.unpinAllInBackground(items, new DeleteCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
if (!isFinishing()) {
shoppingListAdapter.loadObjects(); // update the list view
}
}
}
});
}
}
});
}
}
});
}
ParseQuery queryDeletes=ShoppingItem.getQuery();
queryDeletes.fromPin(MyApplication.ALL_ITEMS);
queryDeletes.whereEqualTo(“isDeleted”,true);
findInBackground(新的FindCallback(){
@凌驾
公共作废完成(最终列表项,e){
如果(e==null){
ShoppingItem.deleteAllInBackground(items,new DeleteCallback()){
@凌驾
公共作废完成(Parsee异常){
如果(e==null){
ShoppingItem.UnpinalInBackground(items,new DeleteCallback()){
@凌驾
公共作废完成(Parsee异常){
如果(e==null){
如果(!isFinishing()){
shoppingListAdapter.loadObjects();//更新列表视图
}
}
}
});
}
}
});
}
}
});
}
已尝试清除应用程序数据并覆盖ShoppingItem中的equals(),但未成功。有什么想法吗
谢谢 好的,我解决了。据我所知,我试图做的是不可能使用解析库 首先,
deleteAllInBackground()
还取消绑定对象,因此不需要unpinalinBackground()
问题是,我使用item.pin(MyApplication.ALL_ITEMS)
固定对象,因此,解除固定的唯一方法是使用item.unpinInBackground(MyApplication.ALL_ITEMS)
传递pin名称。但是,批处理版本不允许将项集合和pin名称作为参数传递。因此,不可能使用命名pin批量取消固定项目
我最终将通过pin名称的对象逐个解钉。我最大的抱怨是在没有pin名的情况下执行item.unpinInBackground()
不会引发异常,因此我不知道问题出在哪里