Foreach slow on Android when looping through json object

I have a json array of about 1000 objects like this:
“20701”: {
“name”: “Hvid”,
“colorcode”: “01”,
“package”: “1000”,
“value”: “0”,
“color”: “#f7f7f6”,
“type”: “Midi”
},
“20101”: {
“name”: “Hvid”,
“colorcode”: “01”,
“package”: “3000”,
“value”: “0”,
“color”: “#f7f7f6”,
“type”: “Midi”
},
“20501”: {
“name”: “Hvid”,
“colorcode”: “01”,
“package”: “6000”,
“value”: “0”,
“color”: “#f7f7f6”,
“type”: “Midi”
},
“50101”: {
“name”: “Hvid”,
“colorcode”: “01”,
“package”: “2000”,
“value”: “0”,
“color”: “#f7f7f6”,
“type”: “Mini”
}
I loop through each item in the array (With foreach), and for each object where package is 1000 i create a button with clone.
In total it is about 60 buttons.

On iOS it takes about 7 seconds. but on Android it takes about 1 min 30 sec.

Any body knows why this is so slow on android.

The rendering loop is slower on your Android device, which causes it to take more time. I’m working on improving this by making the blocks less dependent on the device’s rendering loop, but it’s likely my changes won’t be released until the end of March.

2 Likes

Thank you @paulmw!! I notice stuff like this too. I look forward to the fixes!!!

Now that Extended listviewer has been removed from the comming soon, then I think it is even more important to get a solution to this, as using clone to create lists needs the foreach function.

1 Like

waiting for the solution for this also.

1 Like