C casher2 Member Licensed User Longtime User May 5, 2016 #1 Copied simple one line [test.html] to Files with Add File. Load Layout with one view [WebView1] Command: WebView1.LoadUrl("file:///android_asset/test.html") gives the following error: file:///android_asset/test.html could not be found. (there are no problems with the html file, itself) Hate asking these beginner questions, but that's what I am! Thanks
Copied simple one line [test.html] to Files with Add File. Load Layout with one view [WebView1] Command: WebView1.LoadUrl("file:///android_asset/test.html") gives the following error: file:///android_asset/test.html could not be found. (there are no problems with the html file, itself) Hate asking these beginner questions, but that's what I am! Thanks
eurojam Well-Known Member Licensed User Longtime User May 5, 2016 #2 The Android file system is case sensitive. best to control if your file is realy test.html and not Test.html... Upvote 0
The Android file system is case sensitive. best to control if your file is realy test.html and not Test.html...
C casher2 Member Licensed User Longtime User May 5, 2016 #3 File is all lower case. I've tried various HTMLfiles, all work in browser and if I use Webview1.LoadHTML with the HtML text, it loads fine. Just won't find the file in Assets. Is it as simple as copying the file to [Files]? Thanks for reply. Upvote 0
File is all lower case. I've tried various HTMLfiles, all work in browser and if I use Webview1.LoadHTML with the HtML text, it loads fine. Just won't find the file in Assets. Is it as simple as copying the file to [Files]? Thanks for reply.
C casher2 Member Licensed User Longtime User May 5, 2016 #4 I stumbled across a solution. Don't know why previous didn't work but this does: File.Copy(File.DirAssets, "test.html", File.DirDefaultExternal, "test.html") WebView1.LoadUrl("file://" & File.Combine(File.DirDefaultExternal, "test.html")) Obviously, the test.html does exist or copy file wouldn't work so still puzzled by 'not found error' reported above. Still interested in answer if anyone could explain. Upvote 0
I stumbled across a solution. Don't know why previous didn't work but this does: File.Copy(File.DirAssets, "test.html", File.DirDefaultExternal, "test.html") WebView1.LoadUrl("file://" & File.Combine(File.DirDefaultExternal, "test.html")) Obviously, the test.html does exist or copy file wouldn't work so still puzzled by 'not found error' reported above. Still interested in answer if anyone could explain.
An Schi Well-Known Member Licensed User May 5, 2016 #5 Just a noob myself, so i am also guessing Try: WebView1.LoadUrl(File.DirAssets, "test.html") Upvote 0
C casher2 Member Licensed User Longtime User May 5, 2016 #6 An Schi said: Just a noob myself, so i am also guessing Try: WebView1.LoadUrl(File.DirAssets, "test.html") Click to expand... Gave it a shot. Had to change slightly due to syntax error (needs all in quotes): WebView1.LoadUrl("File.DirAssets,test.html") Got the same error but thanks for the effort/idea. Would guess there's a simple answer but these noob questions seem to get little response from the experts...too bad. Surely been answered before somewhere but specifics are very hard to find, for me at least. Upvote 0
An Schi said: Just a noob myself, so i am also guessing Try: WebView1.LoadUrl(File.DirAssets, "test.html") Click to expand... Gave it a shot. Had to change slightly due to syntax error (needs all in quotes): WebView1.LoadUrl("File.DirAssets,test.html") Got the same error but thanks for the effort/idea. Would guess there's a simple answer but these noob questions seem to get little response from the experts...too bad. Surely been answered before somewhere but specifics are very hard to find, for me at least.
An Schi Well-Known Member Licensed User May 5, 2016 #7 Nood questions DO get response here. Trust me! I think i solved it. See the code here and take care of the #DebuggerForceStandardAssets: true here. See also the attached projetct. It is working fine for me. Edit: Found the solution here: https://www.b4x.com/android/forum/t...g-rapid-”-b4a-3-50-version.38981/#post-230988 Code: Copy #Region Project Attributes #ApplicationLabel: html test #VersionCode: 1 #VersionName: 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: unspecified #CanInstallToExternalStorage: False #DebuggerForceStandardAssets: true #End Region #Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Private WebView1 As WebView End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: 'Activity.LoadLayout("Layout1") Activity.LoadLayout("Main") WebView1.LoadURL("file:///android_asset/test.html") End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Attachments htmltest.zip htmltest.zip 7.8 KB · Views: 364 Upvote 0
Nood questions DO get response here. Trust me! I think i solved it. See the code here and take care of the #DebuggerForceStandardAssets: true here. See also the attached projetct. It is working fine for me. Edit: Found the solution here: https://www.b4x.com/android/forum/t...g-rapid-”-b4a-3-50-version.38981/#post-230988 Code: Copy #Region Project Attributes #ApplicationLabel: html test #VersionCode: 1 #VersionName: 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: unspecified #CanInstallToExternalStorage: False #DebuggerForceStandardAssets: true #End Region #Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Private WebView1 As WebView End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: 'Activity.LoadLayout("Layout1") Activity.LoadLayout("Main") WebView1.LoadURL("file:///android_asset/test.html") End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub
C casher2 Member Licensed User Longtime User May 6, 2016 #8 An Schi said: Nood questions DO get response here. Trust me! I think i solved it. See the code here and take care of the #DebuggerForceStandardAssets: true here. See also the attached projetct. It is working fine for me. Edit: Found the solution here: https://www.b4x.com/android/forum/threads/images-loaded-in-webviews-are-not-displayed-in-mode-“debug-rapid-”-b4a-3-50-version.38981/#post-230988 Code: Copy #Region Project Attributes #ApplicationLabel: html test #VersionCode: 1 #VersionName: 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: unspecified #CanInstallToExternalStorage: False #DebuggerForceStandardAssets: true #End Region #Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Private WebView1 As WebView End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: 'Activity.LoadLayout("Layout1") Activity.LoadLayout("Main") WebView1.LoadURL("file:///android_asset/test.html") End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Click to expand... Brilliant! Thank you! Suspect my problem was with: #DebuggerForceStandardAssets: true RE My comment...writing unique app for medical staff and was facing 'high anxiety'. Thanks again!! Upvote 0
An Schi said: Nood questions DO get response here. Trust me! I think i solved it. See the code here and take care of the #DebuggerForceStandardAssets: true here. See also the attached projetct. It is working fine for me. Edit: Found the solution here: https://www.b4x.com/android/forum/threads/images-loaded-in-webviews-are-not-displayed-in-mode-“debug-rapid-”-b4a-3-50-version.38981/#post-230988 Code: Copy #Region Project Attributes #ApplicationLabel: html test #VersionCode: 1 #VersionName: 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: unspecified #CanInstallToExternalStorage: False #DebuggerForceStandardAssets: true #End Region #Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Private WebView1 As WebView End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: 'Activity.LoadLayout("Layout1") Activity.LoadLayout("Main") WebView1.LoadURL("file:///android_asset/test.html") End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Click to expand... Brilliant! Thank you! Suspect my problem was with: #DebuggerForceStandardAssets: true RE My comment...writing unique app for medical staff and was facing 'high anxiety'. Thanks again!!