How to use the DBUtils.CopyDBFromAssets

winjiadh

Active Member
Licensed User
Longtime User
I download the sample code DBUtils
and I don't know How to use the DBUtils.CopyDBFromAssets

Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
tttt=dbutils.CopyDBFromAssets("\1.db")
SQL.Initialize (File.DirRootExternal, tttt, True)
'SQL.Initialize(File.DirRootExternal, "1.db", True)
End If
.........................................................
how to find the 1.db files,who can tell me how to use the CopyDBFromAssets
the code
If FirstTime Then
tttt=dbutils.CopyDBFromAssets("\1.db")
SQL.Initialize (File.DirRootExternal, tttt, True)
run in error "java.io fileNoFoundException:\1.db
 
Last edited:

winjiadh

Active Member
Licensed User
Longtime User
maybe I post a lot ,but the question alway there

I Don't know how to use the DBUtils.CopyDBFromAssets
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
tttt=dbutils.CopyDBFromAssets("\1.db")
SQL.Initialize (File.DirRootExternal, tttt, True)
'SQL.Initialize(File.DirRootExternal, "1.db", True)
End If
Activity.LoadLayout("1")
how to find the 1.db files,who can tell me how to use the CopyDBFromAssets
the code
If FirstTime Then
tttt=dbutils.CopyDBFromAssets("\1.db")
SQL.Initialize (File.DirRootExternal, tttt, True)
run in error "java.io fileNoFoundException:\1.db
 
Upvote 0

winjiadh

Active Member
Licensed User
Longtime User
who can tell me how to do it ?

:sign0085::sign0085::sign0085::sign0085:
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Please be more patient. This is a community of users who are helping each other. "Bumping" your question two times in several hours will just cause users to ignore your questions.

DbUtils.CopyDBFromAssets return the folder which the file was saved in. It can be other than RootExternal as a storage card might not be available.
B4X:
tttt=dbutils.CopyDBFromAssets("1.db")
SQL.Initialize (tttt, "1.db", True)
 
Upvote 0

winjiadh

Active Member
Licensed User
Longtime User
about the database copy

Sorry,erel,I'm very worry about use the datebase, so I post several times
.
but I can't understand the method
.
I want the programe run frist time builds a database, and store it in the phone, next time the programe runs if the database already, the programe will use it and not rebuilds, if not , the programe builds it again.

I did this in B4P,but in B4A,I didn't know.
 
Upvote 0
Top