Android Question File in Assets logged as Not Being used. [Solved]

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All.

In my Apps I have a file called Help.htm [different content of course] in each App it is loaded in to a webview in the same way. Most Apps Log that this file is not used, in one App it is not logged even though I cannot find any difference in how it is handled.
This is not actually causing any problems but is puzzling.

The file "helpfile.htm" is not referenced in the Main Activity or the Manifest.


Thanks in advance Roger



In the Main Activity
Call HelpActiv:
Sub HelpSub_Click
    BuzzBeep
    StartActivity(HelpActiv)
End Sub



In Help Activity Load Help file to Webview
HlpActiv:
#Region  Activity Attributes
    #FullScreen: true
    #IncludeTitle: false
#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 helpview 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("helplay")
    If Main.InfoFlag = False Then  helpview.LoadURL("file:///android_asset/helpfile.htm")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 

drgottjr

Expert
Licensed User
Longtime User
it's just the compiler trying to be "helpful". the file isn't referenced by any code (technically, it is mentioned within a longer string, but that's not the same as, eg, file.readstring(file.dirasset,"helpfile.htm") where there is a direct reference to a resource. at ease, soldier.
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Thanks for the reply.
I should have said I've been happily ignoring this for years. It is just yesterday I noticed one App was no longer causing the log. Presumably something I did in the last update some time ago.
I ask only as academic interest.
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Erel and all,

All good.

Add XUI library if required and make changes to code shown below, the annoying Log is gone and the HelpFile is displayed as normal.

Regards Roger

Help Activity Module.

Load HTM to Webview changes:
#Region  Activity Attributes
    #FullScreen: true
    #IncludeTitle: false
   
#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 xui As XUI                                                        'Add this line
   
    Private helpview 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("helplay")
'    helpview.LoadURL("file:///android_asset/helpfile.htm")                  'Change this line
    helpview.LoadUrl($"${xui.FileUri(File.DirAssets, "helpfile.htm")}"$)    'to this line
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 
Last edited:
Upvote 0
Top