Which type to use to store values that are in an ArrayList in an SQLite table?

1

I have the following table in SQLite:

db.execSQL("create table amc(_id integer primary key autoincrement, nome text not null, contratada text not null, tipo text not null, data text not null, respostas integer not null, resultado float);");

The respostas field is the following list ArrayList<Integer> respostas = new ArrayList<>(); how can I save the values of this ArrayList<> in my amc table in the respostas field?

Would it be possible?

    
asked by anonymous 21.07.2017 / 19:35

1 answer

2

VARCHAR , there's no other way, you'll have to convert and manage this in the database both for writing and for reading.

You have some strategies that you can use, the most common thing is to separate each element by comma.

SQLite is fantastic, flexible, but let everything on your own do in hand.

Depending on the case the BLOB may be more appropriate.

SQLite Typing .

    
21.07.2017 / 19:47