当前位置:网站首页>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调用时机
边栏推荐
- To sort out messy header files, I use include what you use
- R语言plotly可视化:plotly可视化互相重叠的直方图(historgram)、并在直方图的顶部边缘使用geom_rug函数添加边缘轴须图Marginal rug plots
- Easy to use map visualization
- [test development] software testing - Basics
- 超标量处理器设计 姚永斌 第6章 指令解码 摘录
- 为啥有些线上演唱会总是怪怪的?
- Redis主从复制
- Superscalar processor design yaoyongbin Chapter 7 register rename excerpt
- 超标量处理器设计 姚永斌 第7章 寄存器重命名 摘录
- 就在今天丨汇丰4位专家齐聚,共讨银行核心系统改造、迁移、重构难题
猜你喜欢

补能的争议路线:快充会走向大一统吗?

Vscode modification indentation failed, indent four spaces as soon as it is saved

Weima, which is going to be listed, still can't give Baidu confidence

为啥有些线上演唱会总是怪怪的?

Firewall basic transparent mode deployment and dual machine hot standby

使用3DMAX制作一枚手雷

78 year old professor Huake impacts the IPO, and Fengnian capital is expected to reap dozens of times the return

ISO27001认证办理流程及2022年补贴政策汇总

CocosCreator事件派发使用

Zebras are recognized as dogs, and the reason for AI's mistakes is found by Stanford
随机推荐
【HCIA持续更新】WLAN工作流程概述
补能的争议路线:快充会走向大一统吗?
RecastNavigation 之 Recast
R语言plotly可视化:plotly可视化互相重叠的直方图(historgram)、并在直方图的顶部边缘使用geom_rug函数添加边缘轴须图Marginal rug plots
Tutorial on the use of Huawei cloud modelarts (with detailed illustrations)
DB-Engines 2022年7月数据库排行榜:Microsoft SQL Server 大涨,Oracle 大跌
超标量处理器设计 姚永斌 第5章 指令集体系 摘录
中断的顶半部和底半部介绍以及实现方式(tasklet 和 工作队列)
Win32 API access route encrypted web pages
Performance test of Gatling
Win32 API 访问路由的加密网页
CocosCreator事件派發使用
华为云ModelArts的使用教程(附详细图解)
Self reflection of a small VC after two years of entrepreneurship
【Hot100】32. 最长有效括号
使用3DMAX制作一枚手雷
就在今天丨汇丰4位专家齐聚,共讨银行核心系统改造、迁移、重构难题
Vscode modification indentation failed, indent four spaces as soon as it is saved
[system analyst's road] Chapter 7 double disk system design (structured development method)
曾经的“彩电大王”,退市前卖猪肉