Saving the last item seen in a list

Hi, I have a list that given you a daily goal every time you press a button but when I go out of the program it goes back to the top of the list. How can I make it so that when you open the program it continues from where in the list you had gotten up to? If anyone can tell me how to attach a photo I can send a picture of the code I have.


Please download and post each of those event block(s)/procedures here ...
(sample video)

blocks (3)

blocks (1)

All you have to do is save the Index value in TinyDB on App Exit, and read it from TinyDB when the App is Opened, on Screen Initialization.

Edit: Note, you must not name a Procedure "procedure" - that's a key word and will cause issues when your App is built as an APK. Something Like procedureDailyGoal is a good name.

and set global index to the index of the item saved (so you will need to save this index of the item as well, or find it in your list on startup).

Thanks I will try to do that. If anyone has blocks on how that is done that would be great as I am still pretty new to App inventor.

Try this:
SaveLastUsedItemIndex.aia (3.2 KB)

.... I save the Index every time the User changes it because that's easier than detecting App exit.

... Also trimmed your code down to make it a little bit more efficient - always try to keep your code lean and mean :koala:

Thanks! I really appreciated that you are helping me. I will try the code out.

Your code worked!!!! Thanks so much. :blush: :blush:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.