Android Exception 7(attempt to re-open an already-closed object )
07-23 18:16:17.641: W/SQLiteConnectionPool(28390): A SQLiteConnection object for database '/storage/emulated/0/cnOA.db' was leaked!
Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
这个错误出现的原因是因 为我在一个数据库查询方法中调用了另一个数据库查询方法,我的数据库查询方法都是在开始的时候获取SQLiteDatabase对象,在结束的时候关闭 SQLiteDabse对象,结果内部的数据库查询方法在结束的时候直接关闭了SQLiteDatabase对象,导致外面的数据库查询操作报错,在这里 大家不要以为多获取了几个SQLiteDatabase对象就可以了,每个线程只能使用一个SQLiteOpenHelper,也就使得每个线程使用一个 SQLiteDatabase对象(多线程操作数据库会报错);
解决办法就是我不再关闭内部数据库查询方法的SQLiteDatbase对象或者将那个方法直接集成到外面的查询方法中,当然,要确保这个查询方法只会出 现其他数据库查询方法中,要是单独用这个方法,反而会因为SQLiteDatabase对象没有关闭而报错;
文字来源:http://blog.csdn.net/zhufuing/article/details/14455823
Android Exception 7(attempt to re-open an already-closed object )的更多相关文章
- Android Exception 13(Can't create handler inside thread that has not called Looper.prepare())
10-12 17:02:55.500: E/AndroidRuntime(28343): FATAL EXCEPTION: Timer-2 10-12 17:02:55.500: E/AndroidR ...
- Android Exception 15(关于使用RecyclerView的异常)
04-07 16:32:32.815: E/AndroidRuntime(16173): FATAL EXCEPTION: main 04-07 16:32:32.815: E/AndroidRunt ...
- Android Exception Hook
承接上一篇文章Android Inline Hook,接下来我们看一下android系统中基于异常的hook方式,这种方式与inline hook相比实现较为简单,但执行效率是它的短板. except ...
- [Android Exception 1A] -com.android.volley.NoConnectionError: java.io.InterruptedIOException
- ::-/com.tongyan.tutelage W/System.err: com.android.volley.NoConnectionError: java.io.InterruptedIO ...
- Android Exception Type "share_dialog_title" is not translated in en, zh-rTW strings
异常出现的场景:打包Android项目时出现 解决办法: Eclipse > Preference > Android > Lint Error Checking搜索Messages ...
- [Android exception] /data/app/com.tongyan.tutelage-1/lib/arm/libstlport_shared.so: has text relocations
java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/com.tongyan.tutelage-1/lib/arm/libstlport_s ...
- Android Exception 6 (adapter is not modified from a background thread)
07-23 09:47:34.962: E/AndroidRuntime(7001): java.lang.IllegalStateException: The content of the adap ...
- Android Exception 5(startActivityForResult & singleTask)
昨天碰到一个很诧异的事情,主要内容是1.startActivityForResult(intent2, 302);2.onActivityResult 问题是:onActivityResult调用时间 ...
- Android Exception 9(requestFeature() must be called before adding content)
08-05 17:36:12.799: W/System.err(10378): java.lang.reflect.InvocationTargetException08-05 17:36:12.7 ...
随机推荐
- 算法练习(js)
1. 问题:Spinal Tap Case 将字符串转换为 spinal case.Spinal case 是 all-lowercase-words-joined-by-dashes 这种形式的,也 ...
- 常见OJ提交结果对照表
Waiting:你的程序刚刚提交,正在等待OJ评测你的程序. Compiling:OJ正在编译你的程序. Accepted:OK!你的程序是正确的 ^_^. Wrong Answer:你的 ...
- React 中组件的生命周期
先上代码, react 用的是 15.0.1 <!DOCTYPE html> <html> <head> <script src="./build/ ...
- 【UVA 11077】 Find the Permutations (置换+第一类斯特林数)
Find the Permutations Sorting is one of the most used operations in real life, where Computer Scienc ...
- hdu 1251 (Trie水题)
统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)Total Submi ...
- 【最短路】NOIP模拟赛 虫洞
虫洞 [题目描述] N个虫洞,M条单向跃迁路径.从一个虫洞沿跃迁路径到另一个虫洞需要消耗一定量的燃料和1单位时间.虫洞有白洞和黑洞之分.设一条跃迁路径两端的虫洞质量差为delta. 1. 从白洞跃迁到 ...
- openfire安装完毕后无法登录控制台(忘记密码)的解决方法
openfire登录管理控制提示: Login failed:make sure your username and password are correct and that you’re an a ...
- Train Problem I(模拟栈)
题意:模拟栈,试问使用2个栈,能否使得串1变为串2 思路:模拟,经典问题,注意只要相同的元素放到栈顶后就不会再移动了,只需要考虑剩下的元素,因此每次只考虑一个元素的进入方式. #include< ...
- 2016.4.3 动态规划NOI专练 王老师讲课整理
1.6049:买书 总时间限制: 1000ms 内存限制: 65536kB 描述 小明手里有n元钱全部用来买书,书的价格为10元,20元,50元,100元. 问小明有多少种买书方案?(每种书可购买 ...
- 使用织梦开源的分词算法库编写的YII获取分词扩展
在编辑文章中,很多时候都需要自动根据文章内容获取关键字的功能,因此,本文主要是说明如何在yii中使用织梦开源的分词算法编写一个独立的扩展,可以在不同的模块中使用,步骤如下: 1 到这里下载其他朋友整理 ...