当前位置:网站首页>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调用时机
边栏推荐
猜你喜欢

Master the use of auto analyze in data warehouse

MVC mode and three-tier architecture

Is it science or metaphysics to rename a listed company?

智捷云——元宇宙综合解决方案服务商

【HCIA持续更新】WLAN工作流程概述

2022年全国CMMI认证补贴政策|昌旭咨询

上市公司改名,科学还是玄学?
12 - explore the underlying principles of IOS | runtime [isa details, class structure, method cache | t]

Solve the El input input box For number number input problem, this method can also be used to replace the problem of removing the arrow after type= "number"

表情包坑惨职场人
随机推荐
R language plot visualization: plot visualization of multiple variable violin plot in R with plot
简单易用的地图可视化
创业两年,一家小VC的自我反思
【Proteus仿真】基于VSM 串口printf调试输出示例
DB-Engines 2022年7月数据库排行榜:Microsoft SQL Server 大涨,Oracle 大跌
通过事件绑定实现动画效果
超标量处理器设计 姚永斌 第7章 寄存器重命名 摘录
Implementation of super large-scale warehouse clusters in large commercial banks
【每日一题】556. 下一个更大元素 III
Hidden corners of coder Edition: five things that developers hate most
Oppo Xiaobu launched Obert, a large pre training model, and promoted to the top of kgclue
【209】go语言的学习思想
The controversial line of energy replenishment: will fast charging lead to reunification?
什么是低代码开发?
Developers, MySQL column finish, help you easily from installation to entry
General environmental instructions for the project
如何进行MDM的产品测试
无心剑中译伊丽莎白·毕肖普《一门技艺》
Face_ Attendance statistics of recognition face recognition
你应该懂些CI/CD