Android SQLite database not saving data after app is closed -


i looking examples learn how use sqlite in android , found this: http://examples.javacodegeeks.com/android/core/database/android-database-example/

i downloaded project file , noticed when exit app, if have edited entry or deleted one, doesn't keep changes afterwards. shouldn't database file keep stored , date? needs done code so? thanks!

in example project working has function call in oncreate() of activity causes table dropped each time activity opened:

// drop database if exists db.onupgrade(db.getwritabledatabase(), 1, 2); 

the onupgrade() function drops table:

public void onupgrade(sqlitedatabase db, int oldversion, int newversion)     // drop books table if exists     db.execsql("drop table if exists books");     this.oncreate(db); } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -