Android Question How to get my database in File rahter than Tablet/Iphone memory?

Itila Tumer

Active Member
Licensed User
Longtime User
I have problem with saving into File , I use IDE and sending to Tablet SQLiteLight2 made by Klaus . It save into the Tablet memory. But How could I change that. saving into where my program is and into the File. Do I need to give any dir?

B4X:
Sub Activity_Create(FirstTime As Boolean)
  If FirstTime Then
    ' File.Delete(File.DirInternal, "persons.db") ' only for testing, removes the database
    If File.Exists(File.DirInternal, "persons.db") = False Then
      File.Copy(File.DirAssets, "persons.db", File.DirInternal, "persons.db")
      SQL1.Initialize(File.DirInternal, "persons.db", True)
      File.Copy(File.DirAssets, "persons.db", File.DirInternal, "persons.db")
    Else
      SQL1.Initialize(File.DirInternal, "persons.db", True)
    End If
  End If
 
  Activity.LoadLayout("Main")
  Activity.Title = "SQLiteLight2"
End Sub
 

margret

Well-Known Member
Licensed User
Longtime User
You can ty:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then   
        ' File.Delete(File.DirInternal, "persons.db")
        ' only for testing, removes the database
        If Not(File.Exists(File.DirInternal, "persons.db")) Then
            File.Copy(File.DirAssets, "persons.db", File.DirInternal, "persons.db")
        End If
        'Check For Update File
        If File.Exists(File.DirInternal, "personsupdate.db") Then
            File.Copy(File.DirAssets, "personsupdate.db", File.DirInternal, "persons.db")
        End If
    End If
    SQL1.Initialize(File.DirInternal, "persons.db", True)
    Activity.LoadLayout("Main")
    Activity.Title = "SQLiteLight2"
End Sub
 
Upvote 0
Top