0

I am saving data with Room of architect component in my app and I am using from converter but it save like bellow:

enter image description here

But I need to save values of list one by one in sqlite but save an array.

My entities is HERE.

And I using bellow converter:

public class ContentConverter {
    private Gson gson = new Gson();

    @TypeConverter
    public List<Content> stringToSomeObjectList(String data) {
        if (data == null) {
            return Collections.emptyList();
        }

        Type listType = new TypeToken<List<Content>>() {
        }.getType();

        return gson.fromJson(data, listType);
    }

    @TypeConverter
    public String someObjectListToString(List<Content> someObjects) {
        return gson.toJson(someObjects);
    }
}
jo jo
  • 1,758
  • 3
  • 20
  • 34

0 Answers0