android中关于Sqlite的问题
16lz
2021-12-04
1.不要在UI线程里调用getReadableDatabase ()或者getWritableDatabase ()方法
参见androidAPI文档如下:
Create a helper object to create, open, and/or manage a database. This method always returns very quickly. The database is not actually created or opened until one of getWritableDatabase() or getReadableDatabase() is called.
LikegetWritableDatabase()
, this method may take a long time to return, so you should not call it from the application main thread, including fromContentProvider.onCreate()
.
Database upgrade may take a long time, you should not call this method from the application main thread, including fromContentProvider.onCreate()
.
更多相关文章
- android Webview基本配置以及android与js交互
- Android(安卓)实现闪屏页和右上角的倒计时跳转
- Android作为CXF客户端调用服务端。
- Android(安卓)Audio代码分析13 - AudioTrack::getPosition函数
- 获取未安装的APK图标
- 在Android中实现多线程同步
- popwindow动画显示消失,activity切换动画
- Android(安卓)调用系统的分享[完美实现同时分享图片和文字]
- Android(安卓)学习笔记--android――Activity生命周期,server,Br