Android Question How to add a "HELP" file.

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All,

Another newbie question.

My problem is that I have a working program in one hand and a "Help" file [format .TXT or .RTF or .PDF] in the other hand and no idea how to include the file so that it is accessible as a menu item. Researching the forum/docs/etc I get bits of clues here and there but not enough. Can someone please point me to a "step by step" tutorial or at least a working app as an example.

Regards Roger
 

sorex

Expert
Licensed User
Longtime User
definately HTML, you can use formatting and images in it which is ideal for a help file.
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
I would save the help file as html, adding it to the project files list and show it in my program in an activity with webview.


Thanks MaFu [Et Al]

HTML it is for the format, but I need a bit more detail. I really need to emphasise I am at the bottom of the learning curve.

1. I have created a HTML file and copied to the "File" folder [HELPFILE.HTM]
2. I have added the following code.

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

Dim HELPFILE As WebView

End Sub


Sub Activity_Resume
Activity.AddMenuItem("HELP", "HELPFILE")
End Sub

This brings up a menu but obviously needs more, a guide on the missing steps would be greatly appreciated.

Roger
 
Upvote 0

MaFu

Well-Known Member
Licensed User
Longtime User
Hi Roger

You have two options.
At first, you can add a webview to your current activity with visibility off and set visibility on at help.
Or, i would prefer, create a new activity with a webview.

Your first step, adding the html helpfile to the files folders, is already done. But i advise you to always use lower case filenames.
Then create a new activity and name it "Help".
Start the designer and create a new layout, name it "help". Add a WebView to the layout, full size and with horizontal and vertical anchor to BOTH. Name the WebView "helpfile" and save the layout. Use Tools->CreateMembers to add WebView variable to your current activity.

In your current activity set the menu item:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    ...
    Activity.AddMenuItem("Help", "HelpFile")
    ...
End Sub
and the menu item event:
B4X:
Sub HelpFile_Click
    StartActivity(Help)
End Sub

Then in your helpfile activity:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Help")
    helpfile.LoadURL("file:///android_asset/helpfile.html")
End Sub
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Mafu,

Thanks for the reply, I don't want to be pest but can I ask you to clarify a couple of points.

1. You said "Then create a new activity and name it "Help"."
Do you mean this ?
Sub Activity_Help

End Sub

2. You said "Start the designer and create a new layout, name it "help"."
I can start the designer after that ... no idea.

3. You said "Use Tools->CreateMembers to add WebView variable to your current activity."
Did you mean Tools->GenerateMembers or am I looking at the wrong thing?

I'm sorry to hassle you but after several weeks of playing with B4A I thought I was getting somewhere. I also thought adding a Help file would be as simple as doing a search and following the example. I was wrong.

Thanks in advance.
Roger
 
Upvote 0

MaFu

Well-Known Member
Licensed User
Longtime User
1. Create a new activity:
"Project->Add New Module->Activity Module"​

2. What's unclear with the designer?
With "name it help" i mean: give the layout the filename "help" on save.​

3. "Tools->GenerateMembers"
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Mafu,

Thanks for trying to help but I can see I am just wasting your time. As I can't even figure out "Create New Layout" I think I'll forget the whole thing and not include a help file.

Once again thanks for efforts.

Roger
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Mafu

24hrs away from the computer and re-reading your instructions with others docs the brain clicked in. It is now mostly working except that Webview displays a notice that the Web Page at file:///android_asset/helpfile.html is not available. The file shows in the IDE Files tab, in the forum other people have had this problem but a don't see a solution.

Any idea's?

Roger
 
Upvote 0

RAJAN MBA

Member
Licensed User
Longtime User
@Roger Double check the file name. I noticed that your earlier posts show the help file name with extension 'htm'. May be you haven't changed that.
HTH
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
@Roger Double check the file name. I noticed that your earlier posts show the help file name with extension 'htm'. May be you haven't changed that.
HTH
Yep! I tried it both HTM and HTML and made sure everything matched. A screen shot is attached, maybe you can see something I can't. If not I might start a new thread and stop bothering you.


Roger
 

Attachments

  • Scrnsht.png
    Scrnsht.png
    109.6 KB · Views: 203
Upvote 0
Top