B4A Library [B4X] [XUI] [B4XLib] HintOverlay - display hints that also highlight target views

Segga

Member
Licensed User
Longtime User
You could overcome this by placing a transparent panel above the ScrollView and over the view that you want to highlight.
You would have to calculate where in the scroll view the the item that you want to highlight is and add appropriate adjustments.
It is possible.
 

Jerryk

Active Member
Licensed User
Longtime User
I'm contacting the author. I got this error in Crashlytics.
B4X:
Caused by java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
       at java.util.ArrayList.get(ArrayList.java:437)
       at anywheresoftware.b4a.objects.collections.List.Get(List.java:117)
       at cz.flashcards3000.hintoverlay$ResumableSub_DisplayInstruction.resume(hintoverlay.java:235)
       at cz.flashcards3000.hintoverlay._displayinstruction(hintoverlay.java:177)
       at cz.flashcards3000.hintoverlay$ResumableSub_Show.resume(hintoverlay.java:742)
       at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1748)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7870)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1009)
 

Segga

Member
Licensed User
Longtime User
Looks like the hints are being called too early. Try showing your hints at the end of B4XPage_Appear or add a Sleep(500) before setting up/showing hints.
 

Jerryk

Active Member
Licensed User
Longtime User
Unfortunately, it didn't help. I put the ShowHints procedure at the end of B4XPage_Created. I put Sleep(500) before calling Show. The error doesn't occur on my devices, only during internal verification in Google Play Console does the error occur on some Pixel 6 Pro.
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
....
    showHints
End Sub

Private Sub showHints
    If Starter.kvs.GetDefault("HintMain", False) = False Then
        Sleep(500)
        Hints.BackgroundAlpha = 99
        Hints.CaptionColor=xui.Color_Yellow
        Hints.OutlineColor=xui.Color_Yellow
        Hints.TextColor=xui.Color_Black
        Hints.HighlightTargetView=True
        Hints.Show(B4XComboBox1.mBase,Starter.loc.Loc("h_m_course"))
        Hints.Show(cbLearn, Starter.loc.Loc("h_m_learn"))
        Hints.Show(cbTest, Starter.loc.Loc("h_m_test"))
        Hints.Show(btMenu, Starter.loc.Loc("h_m_menu"))
        Starter.kvs.Put("HintMain", True)
    End If
End Sub

I am attaching a statement from Crashlytics
 

Attachments

  • cz.flashcards3000_issue_3a20ec035d63905bf4908616c74ad02f_crash_session_67CFBC82027100010C46779...txt
    10.5 KB · Views: 86

Segga

Member
Licensed User
Longtime User
It could be that the IndexOutOfBoundsException is caused because the B4XComboBox hasn't loaded yet.
I would try putting invisible panels exactly where your combo boxes are and highlighting those invisible panels - I hope this suggestion works for you.
 

Jerryk

Active Member
Licensed User
Longtime User
Even replacing B4XComboBox with an invisible panel didn't help. On another review, the same error in Crashlytics. I think lstHints.Get(0) reads a B4XView object that doesn't exist yet, which causes the error. Maybe it would be a good idea to put these lines at the beginning of the Show procedure? :
Do While Not(TargetView.IsInitialized)
Sleep(50)
Loop
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…