SQLiteOpenHelper failing to call onCreate?

前端 未结 3 1409
南笙
南笙 2020-11-30 03:04

I am trying to create a local database on an android phone using sqlite.

I have a helper class, shown below, that is used to create the database and pro

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 03:36

    oncreate() method is not a constructor and also Called when the database is created for the first time.So you have to call getWritableDatabase() or getReadableDatabase() for open or create to your database.

    getReadableDatabase() :- Create and/or open a database.

    getWritableDatabase() :- Create and/or open a database that will be used for reading and writing.

提交回复
热议问题