I tested the code below on Samsung without any glitch, but on the Huawei P Smart, I get an error.
On the Samsung tablet, the folder com.bujardet.checkprinterfree is created automatically. On the Huawei, it is nowhere to be seen.
Should I try to create it ?
I will appreciate any help.
Here is the error I get:
Error occurred on line: 3071 (Main)
java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.bujardet.checkprinterfree/files/test.htm (No such file or directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:308)
at java.io.FileOutputStream.<init>(FileOutputStream.java:238)
at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:448)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.ShellBA$1.run(ShellBA.java:77)
at android.os.Handler.handleCallback(Handler.java:907)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7625)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
On the Samsung tablet, the folder com.bujardet.checkprinterfree is created automatically. On the Huawei, it is nowhere to be seen.
Should I try to create it ?
I will appreciate any help.
B4X:
If File.ExternalWritable Then
Dim content As String = "<html><body>" & Html.Replace("LetterSave:","") & "</body></html>"
File.WriteString(File.DirDefaultExternal, LetterSaveFilename, content)
Log("Saved " & LetterSaveFilename)
Else
Log("Could not save " & LetterSaveFilename)
End If
Here is the error I get:
Error occurred on line: 3071 (Main)
java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.bujardet.checkprinterfree/files/test.htm (No such file or directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:308)
at java.io.FileOutputStream.<init>(FileOutputStream.java:238)
at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:448)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.ShellBA$1.run(ShellBA.java:77)
at android.os.Handler.handleCallback(Handler.java:907)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7625)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)