Tried with ImageView and WebView - error (file not found). The files are located in the program folder.
Tell me, please, a solution.
The programs built into the emulator and the device open these files.
It is not necessary in this case. It seems that the problem is that in the file folder the file name is written in Cyrillic characters and this creates problems.
What is the value of "folder" variable? If it is File.DirAssets it will not work.
This works:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
File.Copy(File.DirAssets, "Кеннеди.jpg", File.DirInternal, "Кеннеди.jpg")
End Sub
Sub Button1_Click
Dim folder As String = File.DirInternal
Dim FileName As String ="Кеннеди.jpg"
Dim Html As String = $"<html><body style='margin: 0px; padding: 0px'><img src='${folder}/${FileName}' width='200' /></body></html>"$
WebView1.LoadHtml (Html)
End Sub
I don't get any error "File not found" ?!
The only problem is that nothing is displayed in the WebView.
I also copied the file from File.DirAssets to File.DirInternal, no error and nothing is displayed.
I don't get any error "File not found" ?!
The only problem is that nothing is displayed in the WebView.
I also copied the file from File.DirAssets to File.DirInternal, no error and nothing is displayed.
java.io.FileNotFoundException: /storage/emulated/0/Поколения/Медиа/кеннеди.jpg: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:452)
at java.io.FileInputStream.<init>(FileInputStream.java:76)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:214)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:516)
at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:1342)
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.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at sv.bystrovzorov.datamedia._openimg(datamedia.java:886)
at sv.bystrovzorov.datamedia._setmedia(datamedia.java:974)
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:351)
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.BA$2.run(BA.java:387)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:438)