Android Question error while setting badge number

Makumbi

Well-Known Member
Licensed User
please help
B4X:
        If intCount > 0 Then
            Dim ms As Int = intCount
            Dim lblk As Label = GetAllTabLabels(TabStrip1).Get(3) '1 = tab #2
        '    badger1.SetBadge(lbl, Rnd(1,ms) )
            badger1.SetBadge(lbl, badger1.GetBadge(lblk) + ms)
        Else
            'Dim ms As Int = 0.5
            'badger1.SetBadge(lbl, Rnd(1,ms) )
        End If
error comes when i reach here
B4X:
  badger1.SetBadge(lbl, badger1.GetBadge(lblk) + ms)

B4X:
0782911364
[]
3
Error occurred on line: 279 (Main)
java.lang.RuntimeException: Object should first be initialized (Label).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
    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:348)
    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:176)
    at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:22)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:250)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:137)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
    at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1761)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
 

DonManfred

Expert
Licensed User
Longtime User
Based on the error lbl or lblk are not initialized
 
Upvote 0
Top