Android Question Rich Text Editor not finding 'editor.html'

B G

Member
Licensed User
Longtime User
I know that this question has been asked of sorts before. But I am still not sure of the answer. Most of the forum answers seem to be geared towards WebView and not SMMRichEditor.
When I start my app with the SMMRichEditor control, it works in Release mode but in Debug mode, it displays that 'The webpage at File:///android_asset/editor.html could not be loaded'.
I realise that the reason for the error is that B4A in debug mode uses a 'Virtual assets folder' and there have been several solutions offered but none seem to work or apply to me.

1) Add #DebuggerForceStandardAssets: true
However when I do that in my B4XPages app, the Root.LoadLayout("MainPage") line crashes with 'reflect.invocation.TargetException' error.

2) Use the code found here.
https://www.b4x.com/android/forum/t...g-rapid-”-b4a-3-50-version.38981/#post-230988
However the problem is that the 'Editor.html' file seems to be loaded by the control internally. In the source code of all the examples using SMMRichEditor there is no mention of actually loading 'Editor.html' in the source. So I don't know if that post is applicable or how to use it for SMMRichEditor rather than Webview

3) XUI.FileUrl
Again, the control wants the load the file before I get a chance to do anything in the source, so I can't use that either. If I try to load 'Editor.html' using XUI.FileUrl after everything loads, it has no effect.

As the file seems to be loaded by the control automatically, I see no other way other than to copy the 'Editor.html' to the Virtual Assets folder using CustomBuild before the app starts. But I don't know where that folder is (and I believe Erel has advised not to use it). Copying the file to File.DirDefaultExternal does not work either.

The SMMRichEditor control is not in a layout file. For some reason the app crashes if I do. I create it and add it to a panel in code.

So any suggestions please!!
 

B G

Member
Licensed User
Longtime User
Erel,
For some reason it doesn't crash any more and it works in debug mode properly. I don't know why as it definitely wasn't working before,

Maybe it's where I had '#DebuggerForceStandardAssets: true' in the code. Does it go;
1) In the Main module or B4XMainPage module?
2) In Project Attributes or Activity Attributes (or elsewhere)?

Thank you.
 
Upvote 0
Top