I have a List<Contact>
and I'ld like to put it into a SQLite database.
I've read some other posts saying you need to convert the List to a JSONArray and store it as a TEXT field in the array but I'm a beginner and this is all very confusing.
So far I have a method as follows:
public JSONArray void toJSON() {
JSONArray jsonArray = new JSONArray(myList);
return jsonArray
}
Then in my sqlite database I say:
ContentValues values = new ContentValues();
values.put(KEY_CONTACTS, group.toJSON());
But I am getting an error saying The method put(String, String) in the type ContentValues is not applicable for the arguments (String, JSONArray). I dont know how to properly get it to a string though. Any help would be appreciated.