I have the following error when running:
The imgNewMail is created in the Visual Designer and is not initialized in code:
My Error:
B4X:
Sub setBadges
badger1.SetBadge(imgNewMail, 8)
End Sub
B4X:
Sub Globals
Private dialog As B4XDialog
Private xui As XUI
Private ImageView1 As B4XView
Public API_KEY As String
Private imgNewMail As B4XView <---------------------
Private badger1 As Badger
End Sub
B4X:
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 19 (Badger)
java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at b4a.agritrax.badger._setbadge(badger.java:77)
at b4a.agritrax.main._setbadges(main.java:540)
at b4a.agritrax.main._activity_create(main.java:446)
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 b4a.agritrax.main.afterFirstLayout(main.java:105)
at b4a.agritrax.main.access$000(main.java:17)
at b4a.agritrax.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
** Activity (main) Resume **