Anything I can do to overcome the ClassCastException?
(Testproject attached)
throws this:
(Testproject attached)
B4X:
Sub Activity_Create(FirstTime As Boolean)
'### '### '### '### '###
badger1.Initialize
'### '### '### '### '###
Activity.LoadLayout("Main")
TabStrip1.LoadLayout("Page1", "PAGE 1")
TabStrip1.LoadLayout("Page2", "THIS IS PAGE 2")
TabStrip1.LoadLayout("Page3", "AND PAGE 3")
For i = 1 To 100
Page3ListView1.AddSingleLine($"Item ${i}"$)
Next
Activity.AddMenuItem("Jump to page 1", "mnu1")
Activity.AddMenuItem("Jump to page 2", "mnu2")
Activity.AddMenuItem("Jump to page 3", "mnu3")
'### '### '### '### '###
For Each lbl As Label In GetAllTabLabels(TabStrip1)
badger1.SetBadge(lbl, Rnd(1,20) ) ' <------- ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to anywheresoftware.b4a.BALayout$LayoutParams
Next
'### '### '### '### '###
throws this:
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
badger_createnewpanel (java line: 110)
java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to anywheresoftware.b4a.BALayout$LayoutParams
at anywheresoftware.b4a.objects.ViewWrapper.getLeft(ViewWrapper.java:162)
at anywheresoftware.b4a.objects.B4XViewWrapper.getLeft(B4XViewWrapper.java:106)
at b4a.example.badger._createnewpanel(badger.java:110)
at b4a.example.badger._setbadge(badger.java:280)
at b4a.example.main._activity_create(main.java:378)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at b4a.example.main.afterFirstLayout(main.java:104)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)