B4J Question Save/Load Listview items in SQLite

ThRuST

Well-Known Member
Licensed User
Longtime User
This concerns a B4J listview with added items Test1 and Test2. I am using SQLite with UPDATE to store and retrieve listview items which can be single-clicked in the listview. If I save them with Array As Object as listview.items it looks like this in the database: [Test1, Test2] and when I put them in a List and save them as Array As Strings it looks like this: (ArrayList) [Test1, Test2]

The SQLite table name is User and the cell is Categories.

When I load it back from SQLite it is treated as one string so when added to the listview it's not possible to select each of them only the whole string as [Test1, Test2].

How is it possible to Save (by using UPDATE) and Load Listview items back to work properly in the Listview?
I've got a clue to turn it into a CSV or use B4XSerializor but dunno how to make it work.

UPDATE:
I added a little example that you can make it work and add to your post. When you post your update make sure to add your comment at the history log in the source and save it with a new version number, starting from v0.1. The one who make it work first will win a free virtual toaster and respect from this community :)

v0.1 Basic template by ThRuST (use this if you want to add your solution).
v0.2 Added. Solution by Cableguy.
 

Attachments

  • SQLiteListview v01.zip
    32.6 KB · Views: 293
  • SQLiteListview v02.zip
    37.5 KB · Views: 285
Last edited:

Cableguy

Expert
Licensed User
Longtime User
My Solution, as you put it, is a lazy one... I just put into code what my eyes and head were seeing
I had n items in a list, that I wanted to copy to a row, so, as I would with a piece of paper and a pen, I "wrote" them in sequence...

Sometimes the simpler ways are exactly that... simple!
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
"The simple way are always the best". As my past netfriend Kenny 'Cyberdog' Dion used to say. I hated it, but later I slowly accepted it :)
 
Upvote 0
Top