I have created a SQLite file and putted it on to assets folder. Now I am able to read the data from that file but I don’t have any idea how to write to this database file. I need to take the user name and score and store that in to that database file. I searched on the web and on the SO also but there are examples for the normal database insertion.
Can any one tell me how to store the values into database file. I need to store the username and score. Just think this to as Strings and please give me a example for it.
You should not create database in the assets folder as we can only read data from assets folder.
Infact you should create the database in the default internal folder i.e data/data/[package-name]/databases OR you also can create your database in the sdcard and can perform read-write operation but of course it will not run if there is no sdcard.
The following is the code for creating databse in sdcard:-