当前位置:网站首页>android使用SQLiteOpenHelper闪退
android使用SQLiteOpenHelper闪退
2022-07-04 16:11:00 【蓝之静云】
问题:
已确定自己没错,但是app就是一直闪退
尝试:
删除app,重新安装
例子:
@Override
public void onCreate(SQLiteDatabase db) {
//如果存在group表,则删除该表
String drop_sql = "DROP TABLE IF EXISTS " + CHAT_GROUP + ";";
db.execSQL(drop_sql);
//创建group表
String create_sql = "CREATE TABLE IF NOT EXISTS " + CHAT_GROUP + "("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT,"
+ "group_id VARCHAR NOT NULL,"
+ "chat_type INTEGER DEFAULT NULL"
+ ");";
db.execSQL(create_sql);
}
新增一个字段id,重新运行取id打印,闪退
String sql = String.format("select id,group_id,update_time" +
" from %s where %s;", CHAT_GROUP, condition);
onCreate调用时机
边栏推荐
- 庆贺!科蓝SUNDB与中创软件完成七大产品的兼容性适配
- Image retrieval
- [daily question] 871 Minimum refueling times
- Win32 API 访问路由的加密网页
- Heartless sword Chinese translation of Elizabeth Bishop's a skill
- [test development] software testing - Basics
- What are cache penetration, cache breakdown, and cache avalanche
- regular expression
- 明星开店,退,退,退
- 正则表达式
猜你喜欢

Tutorial on the use of Huawei cloud modelarts (with detailed illustrations)

Make a grenade with 3DMAX

Firewall basic transparent mode deployment and dual machine hot standby

celebrate! Kelan sundb and Zhongchuang software complete the compatibility adaptation of seven products

Mathematical analysis_ Notes_ Chapter 7: differential calculus of multivariate functions

Self reflection of a small VC after two years of entrepreneurship

Detectron2 installation method

五千字讲清楚团队自组织建设 | Liga 妙谈
Blood spitting finishing nanny level series tutorial - play Fiddler bag grabbing tutorial (2) - first meet fiddler, let you have a rational understanding

Offline and open source version of notation -- comprehensive evaluation of note taking software anytype
随机推荐
DB-Engines 2022年7月数据库排行榜:Microsoft SQL Server 大涨,Oracle 大跌
Firewall basic transparent mode deployment and dual machine hot standby
Clever use of curl command
Achieve animation effect through event binding
How to test MDM products
Flask lightweight web framework
超标量处理器设计 姚永斌 第7章 寄存器重命名 摘录
Image retrieval
I2C子系统之适配器的设备接口分析(i2c-dev.c文件分析)
[unity ugui] scrollrect dynamically scales the grid size and automatically locates the middle grid
Zhijieyun - meta universe comprehensive solution service provider
俄罗斯 Arenadata 发布基于PostgreSQL的产品
图像检索(image retrieval)
解决el-input输入框.number数字输入问题,去掉type=“number“后面箭头问题也可以用这种方法代替
无心剑中译伊丽莎白·毕肖普《一门技艺》
What are cache penetration, cache breakdown, and cache avalanche
Implementation of shell script replacement function
Device interface analysis of the adapter of I2C subsystem (I2C dev.c file analysis)
什么是低代码开发?
要上市的威马,依然给不了百度信心