Hi Koders,
I was making a Profile app in which the user adds their image and name to the app.
The list is made with the help of Dynamic Components extension by yusufcihan.
I have also used a extension for circular image which is Leo Profile by DeveloperLeo
In this app in am getting an error as
Which is a well known error.
Though the error is appearing in the companion all is working.
The more items I add in the list the more the error lines are increasing.
This errors are commonly image address which I am retrieving from Firebase and putting them into the list by setting the image from the URL.
These errors are only appearing when I am trying to add the URL to the Firebase.
For more brief explanation
As you can see, there are 3 items in the list
The Name is working good, there are no errors about that so I guess that there is a problem with LeoProfile Extension while selecting.
But in the APK there is other problem while appending
I tried one time in APK
Error message
Select list item: List index too large
Select list item: Attempt to get item number 4 of a list of length 3: (3 image URL)
End Application
@dora_paz,
I had thought about it but it wonât work.
For example there are 2 users online.
The first user adds his profile but only for him he gets value but for other user it will not be updated.
@iamwsumit
No the both lenghts are equal.
Check out the Activity I did.
As many koders where telling that it was not equal so i did an activity.
I placed two labels.
And set the blocks as this
As you can see in that activity, the length of both the list is 4 but the error is telling that one list contains 4 items and the other list has 3 items.
Thatâs what I am confused.
Finally found the Solution,
Thanks all for your cooperation to help me out.
The problem was that Firebase Appends value differently.
I think the list of Firebase (Append) and the list in Kodular are different.
I first add the item to the list then I stored the value.
Any other Koders having the same issue then use this Solution.
#off-topic
By the way the APK runs slower than the Companion in Retrieving the Values.
Sorry Koders,
That was not the Solution.
I just changed few Blocks of working AIA and it again started giving the same Error.
I donât know why the Error is still appearing.
But its working in another AIA.
I tried to debug the Blocks by many ways but none of them worked.
@Taifun,
Thanks for your Reply.
If you notice my Blocks I have set the length of the 3 list in 3 separate Labels and all the values are same.
All are working even the Items are working fine but only the errors are appearing.
Not a solution, just something I noticed in your code.
Took me long to see it but you have CN two times, so you canât be sure that the values are really that length. Iâm still looking if there is that same mistake somewhere else, but change this one also.
I have an idea but I donât know if it will work.
You call Firebase for the value of âCNâ, âDâ and âCIâ at the same time but the app probably doesnât receive them at the same time and each times it get the value from firebase, the block with for each number gets called no matter what.
What I had in mind is adding a if statements.
If length of list CN = length of list CI = length of list D
do
for each number from 1 to the length of list CN
//add what you want here.
If this one doesnât work, they calling the data when the other one receives it value. It will be like this:
When screen initialize
Call firebase get value, tag = CN
When firebase1 get value
If tag = CN
Then:
set global variable CN to value
Call firebase get value, tag = D
If tag = D
Then:
set global variable D to value
Call firebase get value, tag = CI
If tag = CI
Then:
set global variable CI to value
For each number from 1 to length of list CN
do
//what you want here
I donât know if this will work at 100% but give it a try and let me know.