I'm looking to save some information from a ListView to a file and was hoping for a recommendation. I have several items on my ListView and I would like to save at least 3 values for each - the position in the list view, the title (text) that the item has in the ListView, and the file name including the path (because each ListView entry relates to a file that is loaded when a click event takes place).
Still learning, but I was playing with Maps earlier on and since then the project has grown where a key and value may not be enough.
Asked
Active
Viewed 636 times
1

Mr_and_Mrs_D
- 32,208
- 39
- 178
- 361

Tony Moreira
- 93
- 3
- 18
1 Answers
1
You can create a custom type that holds all the required values for each item. You should add an object of that type as the return value (AddSingleLine2...). You have several options for saving the items to a file. One option is to create a List with all the items and use RandomAccessFile.WriteObject to write it to a binary file.

Erel
- 1,802
- 2
- 15
- 58
-
I do have the ListView working fine and built with AddSingleLine2 as you had mentioned and holds 2 of the 3 values - but not familiar with how to create a custom type to get the third. Is there a tutorial at b4a? I had also just started looking at the raf library for saving and will look at that as you suggested. – Tony Moreira Dec 04 '11 at 13:39
-
[Here](http://www.basic4ppc.com/forum/basic4android-getting-started-tutorials/7059-listview-reading-second-line.html#post40547) – Erel Dec 04 '11 at 13:59