SQLiteDatabase.openDatabase vs SQLiteOpenHelper.getReadableDatabase
Is there any difference between these two methods? Both return an opened SQLiteDatabase. Both can create a database if one doesn't exist. SQLiteOpenHelper also has getWriteableDatabase when read/write is needed...
Which method should I use and where? Based on sample code I've seen, I'm using SQLiteOpenHelper to create my database in the first place, but then calling SQLiteDatabase.openDatabase when I need to use the database.
openDatabase()
更灵活,可以指定语言环境等,但对于大多数情况下,您不需要明确提供Android文档所说的使用getReadableDatabase()
和getWriteableDatabase()
。
上一篇: HTML如何判断哪些元素可见?
下一篇: SQLiteDatabase.openDatabase vs SQLiteOpenHelper.getReadableDatabase