Hello,
maybe this is a trivial question, anyhow, I was not able to create a new folder on the internal sd card by using
DBFileDir = Storage.FindDirOrCreate(Storage.Root,"new")
I tried to modify the SaveAs example:
Error message:
The original SaveAs example worked well but I don't want the user choose a folder, the program should copy a file, actually a sqlite database, from the Assets folder into this new folder.
Sorry, but I got totally confused !
Any help is appreciated.
Chris
maybe this is a trivial question, anyhow, I was not able to create a new folder on the internal sd card by using
DBFileDir = Storage.FindDirOrCreate(Storage.Root,"new")
I tried to modify the SaveAs example:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Storage.Initialize (Me, "Storage")
DBFileDir.Initialize
End Sub
Private Sub Button1_Click
DBFileDir = Storage.FindDirOrCreate(Storage.Root,"test")
Wait For (SaveFile(File.OpenInput(File.DirAssets, "test.db"), "application/octet-stream", "test.db")) Complete (Success As Boolean)
Log("File saved successfully? " & Success)
End Sub
Error message:
B4X:
Logger connected to: vivo V2026
--------- beginning of crash
--------- beginning of main
--------- beginning of system
Copying updated assets files (2)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 58 (ExternalStorage)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1055)
at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1060)
at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:417)
at b4a.example.b4xpagesmanager._addpage(b4xpagesmanager.java:245)
at b4a.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:259)
at b4a.example.b4xpagesmanager._initialize(b4xpagesmanager.java:165)
at b4a.example.main._activity_create(main.java:415)
at java.lang.reflect.Method.invoke(Native Method)
The original SaveAs example worked well but I don't want the user choose a folder, the program should copy a file, actually a sqlite database, from the Assets folder into this new folder.
Sorry, but I got totally confused !
Any help is appreciated.
Chris