I have subclass of SQLiteOpenHelper with my own implementation of onCreate, since it's required for creating tables. When I run my application in the emulator, I don't see my table to be created (I added a syntax error in the SQL code that is executed by onCreate). Is it not being invoked by design? Can I somehow force emulator to create the table every time the emulator is run? Or do I have to operate through versions? Or maybe I might be missing something for the tables to be created?

有帮助吗?

解决方案

onCreate is run only once the database is created for the first time. You need to uninstall your app to make it run again.

onUpgrade is used to upgrade the database to a new version but it's usually to upgrade between release version, not during development. If you're just adding more tables, etc. during development, you can just uninstall your app and install again.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top