Quantcast
Channel: Create SQLite database + table and save them for future use - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by laalto for Create SQLite database + table and save them for future use

$
0
0

Assuming you want to insert your three courses to the database only once when the database is created:

  • Move the insert code to database helper onCreate(). It gets called once when the database file didn't exist to start with. Use the SQLiteDatabase supplied as an argument there instead of calling getWritableDatabase() recursively.

  • Insert three times. ContentValuesput() overwrites any value with the same key so essentially you're only really inserting your third course.


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>