Hi everyone,
I’m building a paging UI in MIT App Inventor with:
8 products in a list
5 buttons showing products
FastForward / FastBackward buttons
Logic: circular paging using modulo/remainder.
Problem:
I keep getting this runtime error:
Select list item: Attempt to get item number 0. The minimum valid item number is 1.
Even though:
StartIndex is initialized to 1
CurrentIndex is calculated using modulo
App mostly works visually
Refresh logic (simplified):
CurrentIndex = ((StartIndex + number − 2) mod length Products) + 1
Buttons set using ButtonList[number].
Has anyone faced this issue where modulo logic is correct but index 0 error still appears?
What could cause CurrentIndex to briefly become 0?
Thanks in advance attached is the screen shoot of relevent blocks and its aia
flung (1).aia (1.0 MB)
TIMAI2
February 24, 2026, 2:11pm
2
put the set button text block inside the if statement, it is probably running before Currentindex is set to length of list.
Anke
February 24, 2026, 2:25pm
3
Since the forward and backward buttons are not declared in the button list, the error is inevitable.
Thanks Anke and Tim, tried solutions given by you but still there is error. Fastfarward and FastBackward are not in the button list because they are diffrent from other product buttons.
Thanks Tim.
you were right. when any button click was causing problem. solved thus.
TIMAI2
February 25, 2026, 12:42pm
7
Actually it was @Anke who pointed this out.
I completely rewrote and simplified your aia
1 Like
system
Closed
March 4, 2026, 12:43pm
8
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.