0

I have been banging my head against the wall for a while and I can't figure out how I could store an ArrayList into a sqlite column. I was thing it would work like the following:

Storing into database:

ArrayList -> String
String -> Sqlite column

Retrieving:

Sqlite column data -> ArrayList

However, I am unsure on how to accomplish this? Any guidance or advice?

RedShirt
  • 855
  • 2
  • 20
  • 33
  • an arraylist is a list of things, not a single item, so unless you store it as a delimited string then maybe creating a one to many relationship would be better. – Scary Wombat Apr 15 '14 at 05:35
  • see http://stackoverflow.com/questions/3142285/saving-arraylist-in-sqlite-database-in-android –  Apr 15 '14 at 05:36

1 Answers1

0

Convert List to comma (whatever) delimited String.

Convert delimited String to List.

You will need a large text column though. You never know how large these lists can get. As @Java1 suggested, maybe a master/detail would be better for this?

Community
  • 1
  • 1
velis
  • 8,747
  • 4
  • 44
  • 64