简体   繁体   中英

How to insert multiple values in single cell database table in android?

I am developing an android database application in which i have to add multiple values in single cell of database table like

id| col 1     | col2     |
  | 1,2,3,4   | a,b,c,d  |
  | 1,1,1,1   | ,x,x,x,x |
  |           |          |

i have created the database in SQLite Database Browser

how can i achieve this

You need to serialize the data that you'd like to load into that cell, for example into xml, json, or maybe csv if that suits you. Xml could get a bit messy, for json there's the Gson lib that makes things really easy, and csv is quite straighforward if your data is simple enough.

Use JSON and store it as a String. I would want to seriously take a look why you want to do that though

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM