Sannie72 Member Licensed User Longtime User Mar 1, 2014 #1 Hello, I would like to add a datafile (SQL file) to my app so the user can lookup (address) data from the database. This file needs to available on the first startup. Afterwards the user needs to be able to change the file. How can I include a file in the final APK, and have it extracted when the APK is installed?
Hello, I would like to add a datafile (SQL file) to my app so the user can lookup (address) data from the database. This file needs to available on the first startup. Afterwards the user needs to be able to change the file. How can I include a file in the final APK, and have it extracted when the APK is installed?
mangojack Expert Licensed User Longtime User Mar 2, 2014 #2 Add a copy of your db to your project .. click on the Files Tab (see image) Then ... Code: Copy Sub Activity_Create(FirstTime As Boolean) If FirstTime Then If File.Exists(File.DirInternal, "Database.db") = False Then 'or (File.DirDefaultExternal, File.Copy(File.DirAssets, "Database.db", File.DirInternal, "Database.db") End then use this path for all future read / writes... (File.DirInternal, "Database.db") Attachments Add Files Tab.PNG 5.3 KB · Views: 405 Last edited: Mar 2, 2014 Upvote 0
Add a copy of your db to your project .. click on the Files Tab (see image) Then ... Code: Copy Sub Activity_Create(FirstTime As Boolean) If FirstTime Then If File.Exists(File.DirInternal, "Database.db") = False Then 'or (File.DirDefaultExternal, File.Copy(File.DirAssets, "Database.db", File.DirInternal, "Database.db") End then use this path for all future read / writes... (File.DirInternal, "Database.db")
Sannie72 Member Licensed User Longtime User Mar 2, 2014 #3 mangojack said: Add a copy of your db to your project .. click on the Files Tab (see image) Then ... Code: Copy Sub Activity_Create(FirstTime As Boolean) If FirstTime Then If File.Exists(File.DirInternal, "Database.db") = False Then 'or (File.DirDefaultExternal, File.Copy(File.DirAssets, "Database.db", File.DirInternal, "Database.db") End then use this path for all future read / writes... (File.DirInternal, "Database.db") Click to expand... Thanks mj, just what I needed. I missed the file.copy... Cheers! Upvote 0
mangojack said: Add a copy of your db to your project .. click on the Files Tab (see image) Then ... Code: Copy Sub Activity_Create(FirstTime As Boolean) If FirstTime Then If File.Exists(File.DirInternal, "Database.db") = False Then 'or (File.DirDefaultExternal, File.Copy(File.DirAssets, "Database.db", File.DirInternal, "Database.db") End then use this path for all future read / writes... (File.DirInternal, "Database.db") Click to expand... Thanks mj, just what I needed. I missed the file.copy... Cheers!