Set listview to only first item

Hello,

I'm reaching out to you because I have a problem that I can't seem to solve. I'm creating a workout application, and in this application, the exercises are stored as a list of lists. I want the user to be able to add or remove exercises, and all of this works perfectly.

However, my issue is that in order for the user to view the exercises, I'm using a ListView. But since each exercise is a list of data (used weight, number of sets, etc.), each element is displayed in my ListView. However, I only want the name of the exercise to be displayed. I've tried everything but I can't find the solution.

I hope I've been clear enough, even though it's complicated to explain all of this. Please help me.





Hello Ramon,

First of all, thank you for your response. I didn't know we could use comments like that. However, I'm afraid it won't work in my case because I need to put the name of each exercise for it to work. So, if I add an exercise via the app, I have to go back into the code to add the exercise name in a comment. What I would like is for this to happen dynamically without me having to put the name of each exercise in a comment, you see?

Hello,

those "texts" are not comments...are the result of the blocks ("Do it" functionality)....it was an example to show you how to access to the elements from a list of lists.

As you can see in the example, I have a list of lists, like you, and I am getting not the whole element (Exercide_1, 10, 20) but only the first one (Exercide_1). And the same for the others....so you need to do something similar to get only the element you want.

And other question....why do you have a list, of a list, of a list? why 3 levels of list?

Well, you can create the list from the input data of your app, and manage them in a similar way.

Learn how to use Do it...

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Could you show me that 'do it' block to see how you did it, please? Regarding my lists, let me explain. I have three lists:

  1. One for weight exercises.
  2. One for bodyweight exercises.
  3. One for isolation exercises.

Each list follows the same structure: there are 7 branches in the first list representing 7 muscle groups. Within each of these branches, there are as many exercises as the user wants. And then, each exercise is a list of values. That's basically how it works. There was probably a better way to do it, but that's all I found.

ok thank you for the ressources i never heard about do it before, im french and i don't find a lot of french tutorial but i'll learn how to use do it