문제

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