Android Question Best option to use

joilso oliveira da silva

Member
Licensed User
Longtime User
Hello everyone.

Recently I started using the B4A and I am in doubt about one thing.
I'm creating a list, which should take 2 steps. The first is to show the name of the registered items, and when you touch that item a second list should open and show the data of the item.
Example: List1 - Rice, beans, meat, peas, pasta. (suppose I touched the rice)
List2 - Name: Rice, Weight: 5kg, Size: 50cm, Validity: 28/10
And so on for all items, each with its own specs.
I've searched the forum and I know the first part I can do with a listview and add.singleline2 (showing 1st the product code, and 2nd the name) but my problem is how to do the second part (for now I'm alone making the screens and only then I go through the codes, so stay calm about the connection to the database).

For second screen, I do not know should I use a panel and for labels and edit.texts (I think po panel should not give because there are too many items for the screen.) Or use a CustonListView, after all I will eventually need to edit the items. Or if I only use a list again and I put the data in the second list.

My question is: What is the best option to use, keeping in mind that in the future I will need an option to edit the data?

I think it must have been very clear, and already
 

udg

Expert
Licensed User
Longtime User
One way: expandable list
Another way: a primary listview then a details panel; as long as you don't need/want a DB you could store data in a new type variable (e.g. MyItem - Name:string; Weight: integer..), save it in a list and use a ListView or CLV (CustomListView) to show just the name for initial selection and a details panel for its data. primaryListView and panel could coexist in a single screen; if you have many details you could consider a scrollview too (which will take you back to consider a CLV from the beginning..).
A third way: like the above, but with a detail panel that "superimposes" itself on the primary list when an item is selected.

These are just the first three ways I thinked of when reading your post. As you can easily believe there are many more. My suggestion is to spend some more time on how you would like to show data to your customer..B4X will certainly have a way to second it.

udg
 
Upvote 0

npsonic

Active Member
Licensed User
Here's example for you. What you are asking is super simple create and I hope example proves it.

You just start new activity by clicking one of the items in your list. This example uses CustomListView and KeyValueStore2.
 

Attachments

  • Example.zip
    14.3 KB · Views: 194
Upvote 0

joilso oliveira da silva

Member
Licensed User
Longtime User
Got it!

In the future I will use a local database (maybe MySQL) to be able to fill in the data of the tables.
So I do not know if I can use a listView, due to the fact that it will be data that will constantly change.
And there's the second screen that will have to be editable.
Example: List2 - rice - Weight: 5kg. But now the rice has 10kg, I need to edit.
List - Rice - Weight: 10kg
So being editable, and adding to what you said, I think the best option is the CustonListView (correct me if I'm wrong) because with it I get the names (in the labels) and edit (with editTexts) the information if necessary.
Is this the ideal?
Thank you in advance for the help.
Ps: i using google translator, then forgive any typo.
 
Upvote 0

npsonic

Active Member
Licensed User
Got it!

In the future I will use a local database (maybe MySQL) to be able to fill in the data of the tables.
So I do not know if I can use a listView, due to the fact that it will be data that will constantly change.
And there's the second screen that will have to be editable.
Example: List2 - rice - Weight: 5kg. But now the rice has 10kg, I need to edit.
List - Rice - Weight: 10kg
So being editable, and adding to what you said, I think the best option is the CustonListView (correct me if I'm wrong) because with it I get the names (in the labels) and edit (with editTexts) the information if necessary.
Is this the ideal?
Thank you in advance for the help.
Ps: i using google translator, then forgive any typo.
You have to use SQLite localy there is no other choices. Check my example, so you understand what you need to do.
 
Upvote 0

joilso oliveira da silva

Member
Licensed User
Longtime User
[QUOTE = "npsonic, post: 616613, member: 104635"]Veja meu exemplo para entender o que você precisa fazer. [/ QUOTE]


Eu vou olhar agora! E eu já agradeço a sua ajuda.
 
Upvote 0
Top