当前位置:网站首页>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调用时机
边栏推荐
- 如何进行MDM的产品测试
- Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
- Pytorch深度学习之环境搭建
- Heartless sword Chinese translation of Elizabeth Bishop's a skill
- 用于图数据库的开源 PostgreSQL 扩展 AGE被宣布为 Apache 软件基金会顶级项目
- 图像检索(image retrieval)
- Once the "king of color TV", he sold pork before delisting
- 股价大跌、市值缩水,奈雪推出虚拟股票,深陷擦边球争议
- 78 year old professor Huake impacts the IPO, and Fengnian capital is expected to reap dozens of times the return
- 超标量处理器设计 姚永斌 第7章 寄存器重命名 摘录
猜你喜欢

wuzhicms代码审计

With an annual income of more than 8 million, he has five full-time jobs. He still has time to play games

CocosCreator事件派发使用

Talk about seven ways to realize asynchronous programming

Why are some online concerts always weird?

People in the workplace with a miserable expression

创业两年,一家小VC的自我反思

Ks007 realizes personal blog system based on JSP

Interpretation of data security governance capability evaluation framework 2.0, the fourth batch of DSG evaluation collection

With an estimated value of 90billion, the IPO of super chip is coming
随机推荐
Five thousand words to clarify team self-organization construction | Liga wonderful talk
Dynamic programming stock problem comparison
Large scale service exception log retrieval
[daily question] 556 Next bigger element III
Offline and open source version of notation -- comprehensive evaluation of note taking software anytype
[HCIA continuous update] WLAN overview and basic concepts
Is BigDecimal safe to calculate the amount? Look at these five pits~~
R language plot visualization: plot visualization of multiple variable violin plot in R with plot
图像检索(image retrieval)
How to test MDM products
curl 命令妙用
DB engines database ranking in July 2022: Microsoft SQL Server rose sharply, Oracle fell sharply
曾经的“彩电大王”,退市前卖猪肉
用于图数据库的开源 PostgreSQL 扩展 AGE被宣布为 Apache 软件基金会顶级项目
【209】go语言的学习思想
超标量处理器设计 姚永斌 第5章 指令集体系 摘录
High school physics: force, object and balance
Superscalar processor design yaoyongbin Chapter 5 instruction set excerpt
RecastNavigation 之 Recast
What are cache penetration, cache breakdown, and cache avalanche