android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or da
2014-01-08 11:52
477 查看
Cursor cursor=null; Cursor cursor2=null; db = helper.getReadableDatabase(); try{ cursor=rawQuery("...",null); while (cursor.moveToNext()) { // ... cursor2=db.rawQuery("select file_path from memos where time > "+date+" and time < "+lg+" order by time desc",null); if(cursor2.moveToNext()){ //... } cursor2.close(); // 因是在循环内,要在此处加上关闭,而不仅只在finally中关闭 // ... } } }finally{ if(cursor!=null){ cursor.close(); } if(cursor2!=null){ cursor2.close(); } db.close(); // 此处可以根据情况关闭与否 }
相关文章推荐
- android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or da
- Application did not close the cursor or database object that was opened here 异常
- android.database.sqlite.databaseobjectnotclosedexception:应用程序没有关闭的光标或数据库对象
- 07-09 03:16:08.655: E/Database(426): android.database.sqlite.DatabaseObjectNotClosedException: Appli
- android.database.sqlite.databaseobjectnotclosedexception:应用程序没有关闭的光标或数据库对象
- Caused by: android.database.sqlite.SQLiteDatabaseCorruptException: file is encrypted or is not a dat
- android.database.StaleDataException: Attempted to access a cursor after it has been closed
- Exit the Android application or Close all the Android ativities
- [Android] View.setTag(key,Object) (java.lang.IllegalArgumentException: The key must be an application-specific resource id.)
- Android Finalizing a Cursor that has not been deactivated or closed
- Caused by: android.database.StaleDataException: Attempted to access a cursor after it has been close
- android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error(Sqlite code 14): Could not open database,(OS error - 13:Permission denied)
- android.database.StaleDataException: Attempted to access a cursor after it has been closed
- 解决 DatabaseObjectNotClosedException
- 异常:android.database.StaleDataException: Attempted to access a cursor after it has been closed
- sqlite在Android上的一个bug:SQLiteCantOpenDatabaseException when nativeExecuteForCursorWindow
- 报错 BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext 的解决方法
- DevExpress Exception Solution - The target "X" for the callback could not be found or did not implement ICallbackEventHandler
- android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open dat
- android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open