【发布时间】:2015-09-28 10:51:10
【问题描述】:
我正在使用 SQLite 数据库获取表的记录,如果存在特定记录。运行应用程序时总是出错 = 原因:java.lang.IllegalStateException:数据库/data/data/com.example .tazeen.xxx/databases/xx(conn# 0) 已经关闭
dbhelper = new MyDbHelper(this);
SQLiteDatabase db1 = dbhelper.getReadableDatabase();
Cursor cursor = db1.rawQuery("select * from ActivityObjectList", null);
if (cursor.moveToFirst()) {
do {
imageName = cursor.getString(cursor.getColumnIndex("imageaudioPath"));
String strDownLoadStatus = cursor.getString(cursor.getColumnIndex("DownLoad_Status"));
} while (cursor.moveToNext());
}
cursor.close();
db1.close();
}
【问题讨论】:
-
在应用程序级别创建数据库实例
-
你能知道异常在哪一行抛出。
标签: android