您好,在我的项目中,我使用getContentResolver
方法在for循环中更新数据库。这是我用于更新数据库的编码
for(VOShoplyRetailer retailer:retailerMasterList){
ContentValues retailerCV = retailer.parseToContentValues();
int affectedRows = context.getContentResolver().update(DataContract.RetailerMasterEntry.RETAILER_MASTER_CONTENT_URI,
retailerCV,
DataContract.RetailerMasterEntry.COLUMN_RETAILER_ID+" = ?",
new String[]{retailer.getRetailerId()}
);
}
我收到错误
03-20 11:55:45.279 6777-6786/com.example W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '+data+data+com_example+databases+example_db' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
03-20 11:55:45.299 6777-6786/com.example W/CursorWrapperInner﹕ Cursor finalized without prior close()
如何在getContentResolver中关闭游标(或)如何修复此错误。
答案 0 :(得分:0)
在ContentProvider更新实现中,在返回之前关闭数据库..也许类似
V-HACD (Volumetric Hierarchical Approximate Convex Decomposition)