Android Example Help Management for Application

Hello hope your'e well.
Apps are getting more and more complicate and to work with the user needs a manual. This examples shows how you can add an help dialog to your B4XPages Project. The help information is taken from a pdf file. The help index is created from the app. If you do not like to show the help as a dialog it should be easy to modify the code to show it on a B4XPage or Activity.

Features:
- show individual pdf file (manual)
- goto first, next, previous, last pdf page
- goto entered page number
- create and show Page Index
- goto page number selected by index
- move and zoom pdf page with gestures

Version 1.0
Licence free for private and commercial use of Board Members
Find Example B4A Project attached.


Setup in Page_created sub:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root1.LoadLayout("B4XMain")
    
    'Initialize Help Dialog
    DLGHelp.Initialize(Root)
    
    ' setup helpindex key= page no, value= title
    IndexValues.Put(1,"Index")
    IndexValues.Put(2,"Chapter 1 ...")
    ' setup HelpFileName
    HelpFileName="acr1255u.pdf"
    ' set dialog properties
    DLGHelp.Title = "Help AppName"
    DLGHelp.TitleBarColor=Colors.Blue
    DLGHelp.TitleBarTextColor=Colors.White
    DLGHelp.BorderColor=Colors.Blue
    DLGHelp.BorderWidth=2dip
    DLGHelp.BorderCornersRadius=5dip
    DLGHelp.ButtonsColor=Colors.Blue
    DLGHelp.ButtonsTextColor=Colors.white
    DLGHelp.BackgroundColor=Colors.white
End Sub
 

Attachments

  • Screenshot_20210713-125404.png
    Screenshot_20210713-125404.png
    173.5 KB · Views: 572
  • Screenshot_20210713-125410.png
    Screenshot_20210713-125410.png
    17.5 KB · Views: 496
  • pdfHelpExample.zip
    263.6 KB · Views: 401

Daniel44

Active Member
Licensed User
error:

ERROR LOG:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
Error occurred on line: 85 (B4XMainPage)
java.lang.IllegalArgumentException: Invalid page index
    at android.graphics.pdf.PdfRenderer.throwIfPageNotInDocument(PdfRenderer.java:284)
    at android.graphics.pdf.PdfRenderer.openPage(PdfRenderer.java:231)
    at de.donmanfred.PDFRendererwrapper.renderPageforDisplay(PDFRendererwrapper.java:79)
    at TechDoc.pdfHelp.b4xmainpage$ResumableSub_BtshowHelp_Click.resume(b4xmainpage.java:307)
    at TechDoc.pdfHelp.b4xmainpage._btshowhelp_click(b4xmainpage.java:231)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:7448)
    at android.view.View.performClickInternal(View.java:7425)
    at android.view.View.access$3600(View.java:810)
    at android.view.View$PerformClick.run(View.java:28305)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7656)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**
 

GMan

Well-Known Member
Licensed User
Longtime User
Would be nice to know which libs are necessary
 
Top