Android Question SOLVED - Problem with displaying help files

Robert Valentino

Well-Known Member
Licensed User
Google now requires showing a Consent page and I cannot get it to display properly in B4XPages

NOTE: Attaching a test program not actual program but results are the same.

TRYING a bunch of ways
If I get the page to display then the JPG's on the page do not display.
But most of the time I cannot get the page to display

Can someone please help. ALL my Help has the same problem.
Help is in the Files\Help directory and each page has a sub directory that contains the graphics (word does this when creating pages)

I have no idea how to tell the IDE that a page (in this case - privacypolicy.htm) has a sub directory privacypolicy_files where it pulls all the graphics from

Thanks in advance.

BobVal
 

Attachments

  • Project.zip
    41.2 KB · Views: 30
Last edited:

LucaMs

Expert
Licensed User
1.

1616693874663.png



2. Why not create a specific "Consent" B4XPage?
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
WOW - never noticed that export.

This is just one page. I have a whole help system that works fine as a now B4XPages but nothing is working properly under B4XPages.
Each module just calls the Help Page passing the file name to display that is a B4XPage this is just one specific case for the Consent page.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
When I get the page to display the two files that are logo's aren't showing.
 

Attachments

  • Screenshot_20210325-144951.jpg
    Screenshot_20210325-144951.jpg
    74.3 KB · Views: 49
Upvote 0

William Lancee

Active Member
Licensed User
For some of us, your use of "page" is confusing. I tried your code and I can't see that this has anything to do with B4XPages. You are having problems with a Web "page", created by Word. If you click on your privacypolicy.htm file, your browser will display the page you see above. Perhaps others in the community are willing to look at this .htm file to see what is wrong with it.

As an aside, your unorthodox use of TABs in your code is a real hindrance to experimenting with it - it fights with the IDE IntelliSense .
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Please explain unorthodox use of TABs??

So you are saying that because I like to format my code instead of stuffing it all together that is why this it is not loading the images from the help subdirectory???

I like my code to line up. Even at 70+ I can probably type faster then most and putting in extra tabs and spaces to give me a better visual is not a problem.
NOT to pick on anyone, we all have our own style but some of you guys make like having code look nice and readable will effect the way it works (the compiler should strip all this out). I have zero problems with the IDE and IntelliSense or none I've every realized.

1616776151038.png


Hey if taking out TABs and extra spaces solves the problem them I am all for it, but I do not think it will
 
Upvote 0

William Lancee

Active Member
Licensed User
Ouch. I regret that you took my response in that way. I looked at your code, and while it looks beautiful, I struggled with the formatting. In the end I found that the problem had to do with your .htm file and how it referenced resources. I reported my findings and "As an aside" I also reported that I struggled.

Obviously you can code anyway you like, I have no criticism of that. "As an aside", I am older than you.
 
Upvote 0

aeric

Expert
Licensed User
1616826704155.png

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'load the layout to Root
    Root.LoadLayout("Consent")
    Dim strHtml As String = File.ReadString(File.DirAssets, "privacypolicy.htm")
    strHtml = strHtml.Replace("image003.jpg", WebViewAssetFile("image003.jpg"))
    strHtml = strHtml.Replace("image001.jpg", WebViewAssetFile("image001.jpg"))
    WebView1.LoadHtml(strHtml)
End Sub

Sub WebViewAssetFile (FileName As String) As String
    Dim jo As JavaObject
    jo.InitializeStatic("anywheresoftware.b4a.objects.streams.File")
    If jo.GetField("virtualAssetsFolder") = Null Then
        Return "file:///android_asset/" & FileName.ToLowerCase
    Else
        Return "file://" & File.Combine(jo.GetField("virtualAssetsFolder"), _
       jo.RunMethod("getUnpackedVirtualAssetFile", Array As Object(FileName)))
    End If
End Sub
 

Attachments

  • Project.zip
    51.2 KB · Views: 29
Upvote 0
Top