当前位置:网站首页>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调用时机
边栏推荐
- ARTS_ twenty million two hundred and twenty thousand six hundred and twenty-eight
- Mathematical analysis_ Notes_ Chapter 7: differential calculus of multivariate functions
- "In Vietnam, money is like lying on the street"
- R language plot visualization: plot visualizes overlapping histograms and uses geom at the top edge of the histogram_ The rug function adds marginal rug plots
- Win32 API 访问路由的加密网页
- [HCIA continuous update] overview of WLAN workflow
- 【每日一题】556. 下一个更大元素 III
- 五千字讲清楚团队自组织建设 | Liga 妙谈
- High school physics: force, object and balance
- Rainfall warning broadcast automatic data platform bwii broadcast warning monitor
猜你喜欢
Firewall basic transparent mode deployment and dual machine hot standby
With an estimated value of 90billion, the IPO of super chip is coming
People in the workplace with a miserable expression
Self reflection of a small VC after two years of entrepreneurship
【HCIA持续更新】WLAN工作流程概述
Make a grenade with 3DMAX
智捷云——元宇宙综合解决方案服务商
The Block:USDD增长势头强劲
78 year old professor Huake impacts the IPO, and Fengnian capital is expected to reap dozens of times the return
Zebras are recognized as dogs, and the reason for AI's mistakes is found by Stanford
随机推荐
KS007基于JSP实现人个人博客系统
curl 命令妙用
【Proteus仿真】基于VSM 串口printf调试输出示例
高中物理:力、物体和平衡
[daily question] 556 Next bigger element III
[HCIA continuous update] WLAN overview and basic concepts
【HCIA持续更新】网络管理与运维
[test development] software testing - Basics
New technology releases a small program UNIPRO to meet customers' mobile office scenarios
[HCIA continuous update] overview of WLAN workflow
Superscalar processor design yaoyongbin Chapter 6 instruction decoding excerpt
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"
Five thousand words to clarify team self-organization construction | Liga wonderful talk
超标量处理器设计 姚永斌 第6章 指令解码 摘录
The Block:USDD增长势头强劲
High school physics: force, object and balance
Face_recognition人脸识别之考勤统计
Zhijieyun - meta universe comprehensive solution service provider
The top half and bottom half of the interrupt are introduced and the implementation method (tasklet and work queue)
Firewall basic transparent mode deployment and dual machine hot standby