Android Question SD_ShopListView

spiroskaras

Member
Licensed User
Longtime User
Please Help.
If i clear ShopListView with the Clearall and reload items in list gives me an out of bound error. (if you dont change index in the list,remain to the top ,does not gives you the error)


Error occurred on line: 686 (ShopListView)
java.lang.ArrayIndexOutOfBoundsException: length=0; index=-2
at java.util.ArrayList.get(ArrayList.java:439)
at anywheresoftware.b4a.objects.collections.List.Get(List.java:117)
at b4a.example.shoplistview._invalidateimage(shoplistview.java:1581)
at b4a.example.shoplistview._invalidate(shoplistview.java:196)
at b4a.example.shoplistview._clearall(shoplistview.java:105)
at b4a.example.main._button2_click(main.java:641)
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:157)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:205)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:7881)
at android.widget.TextView.performClick(TextView.java:16203)
at android.view.View.performClickInternal(View.java:7858)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:30863)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8775)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
 

Star-Dust

Expert
Licensed User
Longtime User
I've done some tests and there doesn't seem to be any errors. Produce an example that throws you this error and attach it so I can review it
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Sorry it doesn't access the DB and so I can't test it. Furthermore, ShopListView1.Invalidate is missing after inserting the data that would serve to update the list.

Are you sure the error is not generated in accessing the data rather than from the ShopList?

Produce an example with some local data, even randomly generated so I can examine the problem
 
Upvote 0

spiroskaras

Member
Licensed User
Longtime User
hello,
here is a new sample
3 buttons with different lists,if you scroll down a list and then you change list you produce an error
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
It doesn't throw me any errors. Does this example you sent to you throw error?

ezgif.com-resize.gif


maybe you modified the library?
 
Last edited:
Upvote 0

spiroskaras

Member
Licensed User
Longtime User
hello ,yes
no modification, the error occurs when i scrol down the list and then i change list
if you dont scroll down list ,in change list is not throwing error
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
is an untouched sample ,i only put some buttons in order to change lists
Yes I was referring to the library not the example that you can change as you want.
Then the problem would be that you clear the list while still the animation is displaying and it throws the error.
Download the latest version. Correct the bug
 
Last edited:
Upvote 1
Top