I am starting to use my first database and am getting an error.
sql1.initialize(file.dirdefaultexternal,"android.database.sqlite.SQLite Can't Open Database Exception: Unable to open database file.
From what I found I need to add Write External something to the Manifest file.
I added the below to the Manifest but I get the same error.
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
Unfortunately you don't give enough information to give a concrete advice.
Can't you post a small project showing the problem as a zip file ?
So we could test it and see where the problem is.
I tested your project and it creates the file test1.db to File.DefaultExternal on my device with no problems. Maybe your device does not have an external sd.
Try this: File.DirInternal instead of File.DirDefaultExternal
B4X:
If FirstTime Then
SQL1.Initialize(File.DirInternal, "test1.db", True)
End If
Ok. Now I changed it to internal and am getting the below error. Here is what I changed the code to. Are there any changes I need to make to the Manifest for internal like I had to do for external?
SQL1.Initialize(File.DirInternal, "ThinkFast.db", True)
It is the same as the file I posted except I changed the line from dirdefaultexternal to dirinternal and the error is
sql1.initialize(file.dirinternal,"thinkfast"
java.lang.nullpointerexception