Hello,
I am getting the error intermittently while running xcustomlistview.
The below is the code :
Am I getting the below error:
Please advice
I am getting the error intermittently while running xcustomlistview.
The below is the code :
B4X:
Private Label1 As B4XView
Private Label2 As B4XView
Private CustomListView1 As CustomListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("xclv")
Dim xui As XUI
For i=0 To 49
Dim p As B4XView=xui.CreatePanel("")
p.SetLayoutAnimated(100,0,0,100%x,40dip)
p.LoadLayout("LisLoad")
Label1.Text=i
Label2.Text="The Item No is : " & i
CustomListView1.Add(p,"")
Next
End Sub
B4X:
Error occurred on line: 40 (Main)
java.lang.NullPointerException: Attempt to invoke virtual method 'int anywheresoftware.b4a.objects.collections.List.getSize()' on a null object reference
at b4a.example3.customlistview._add(customlistview.java:71)
at b4a.example.main._activity_create(main.java:417)
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.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:7025)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Please advice