Hello guys,
I have a database (genealogy.db) that I'm trying to read and added it to my app assets using Designer tool files tab, however when I run the program I got the following message when during File.Copy(File.DirAssets, FileName, TargetDir, FileName):
I then check the files tab of the Designer and the file is not there anymore, even file been still in PC asset folder.
Any clues on where should I put my database file?
I have a database (genealogy.db) that I'm trying to read and added it to my app assets using Designer tool files tab, however when I run the program I got the following message when during File.Copy(File.DirAssets, FileName, TargetDir, FileName):
Logger connected to: samsung SM-J500M
--------- beginning of system
--------- beginning of main
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 32 (DBUtils)
java.io.FileNotFoundException: /data/user/0/b4a.GenealogyLite/files/virtual_assets/genealogy.db: open failed: ENOENT (No such file or directory)
--------- beginning of system
--------- beginning of main
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 32 (DBUtils)
java.io.FileNotFoundException: /data/user/0/b4a.GenealogyLite/files/virtual_assets/genealogy.db: open failed: ENOENT (No such file or directory)
B4X:
Sub CopyDBFromAssets (FileName As String) As String
Dim TargetDir As String
If File.ExternalWritable Then
TargetDir = File.DirDefaultExternal
Else
TargetDir = File.DirInternal
End If
If File.Exists(TargetDir, FileName) = False Then
File.Copy(File.DirAssets, FileName, TargetDir, FileName)
End If
Return TargetDir
End Sub
I then check the files tab of the Designer and the file is not there anymore, even file been still in PC asset folder.
Any clues on where should I put my database file?