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 )

时间: 2024-10-29 19:07:32

Android Exception 7(attempt to re-open an already-closed object )的相关文章

Android Exception 10((server)' ~ Channel is unrecoverably broken and will be disposed!)

08-11 19:22:35.028: W/MemoryDealer(2123): madvise(0x43e16000, 12288, MADV_REMOVE) returned Operation not supported on transport endpoint 08-11 19:22:35.038: W/InputDispatcher(2714): channel '4236b890 com.tongyan.activity/com.tongyan.activity.SettingA

Android Exception 11(baidumapsdk(15405): Authentication Error errorcode: 102 uid)

08-12 16:06:12.622: E/baidumapsdk(15405): Authentication Error errorcode: 102 uid: null appid -1 msg: IP/SN/SCODE/REFERER Illegal: http://bbs.lbsyun.baidu.com/viewthread.php?tid=9392 先看下这个贴,弄了半天,最后把调试用的debug.keystore换成发布用的.keystore换个名字.对这个功能还需要嗤之以鼻?

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/AndroidRuntime(28343): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() 10-12 17:02:55.500: E/AndroidRuntim

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.799: W/System.err(10378):     at java.lang.reflect.Method.invokeNative(Native Method)08-05 17:36:12.809: W/System.err(10378):     at java.lang.reflect.

Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setHomeButtonEnabled(boolean)' on a null object reference

[Android]getActionBar()为null的解决方法总结 setContentView(R.layout.activity_main);android.support.v7.app.ActionBar actionBar = getSupportActionBar();actionBar.setHomeButtonEnabled(true);actionBar.setDisplayShowHomeEnabled(true);actionBar.setIcon(R.mipmap.ic

2类型转换异常:Exception in thread "main" java.lang.ClassCastException:java.lang.Object cannot be cast to java.lang.Integer

public class TestException {    public static void main(String[] args) {        Object obj = new Integer(1);        int i =(Integer)(obj);        System.out.println(i);                Object object = new Object();        if (object instanceof Integer

Android Exception

记录Android开发过程中遇到的问题,包括但不局限于异常及错误. 可使用网页自带搜索工具快速检索需要的Exception 其它问题: 一.导入项目时,提示 "invalid project description" 无效的项目描述,应该与ADT版本不同有关. 出错背景:外来源码放在工作区,然后导入Eclipse. 解决方法:外来源码先放在非工作区(如:桌面),然后导入到Eclipse,导入页面勾上 "copy projects to into workspace"

Android - Exception raised during rendering: java.lang.System.arraycopy

Exception raised during rendering: java.lang.System.arraycopy 本文地址: http://blog.csdn.net/caroline_wendy Error: Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V 错误导致UI无法显示,原因是Android的SDK使用Level20的可穿戴版本,下载其它的SDK即可. 基本原因是Android S

[Android Exception 1A] -com.android.volley.NoConnectionError: java.io.InterruptedIOException

12-24 14:21:47.470 24220-24220/com.tongyan.tutelage W/System.err: com.android.volley.NoConnectionError: java.io.InterruptedIOException 12-24 14:21:47.470 24220-24220/com.tongyan.tutelage W/System.err: at com.android.volley.toolbox.BasicNetwork.perfor