我正在使用滑动从SQLite数据库中删除项目,从数据库删除项目,但select store_code, customer_id , to_char(purchased_at, 'YYYYMM') as yyyymm,
sum(cast(rl.value as numeric(18, 2))) rev
from receipts r join
receipt_lines rl
on r.receipt_id = rl.receipt_id
group by store_code, customer_id, yyyymm
order by store_code asc, yyyymm;
功能不适用于notifyItemRemoved()
,它在删除项目的位置显示空白
RecyclerView
答案 0 :(得分:0)
您所要做的就是执行3个步骤。
代替getItemCount()
传递data.size()
;
data.remove(position); //removing data from collection
notifyItemRemoved(position); //notifying item is removed at a given index
notifyItemRangeChanged(position, data.size()); //notifying range is change
评论下面提到的这些行并运行上面提到的这4行。!
// mDatabaseHelper.open();
// mDatabaseHelper.deleteSubCartItems(data.get(position).getActivityId());
// mDatabaseHelper.deleteMyCartItem(data.get(position).getActivityId());
// mDatabaseHelper.close();
如果它工作正常,那么您的数据库查询也会出现问题,并且也会共享LOG。