I am using Room
to manage SQLite databasae in my app. The thing is that I am migrating a project, in which I download some data from a private webservice and finally I am receiving a ContentValues
object which contains all the data to save to my POJO (let's say UserPojo). Because I have this ContentValues object, I initially thought in using the SqLiteOpenHelper's insert
method, but I do not know how to get an instance of it from my RoomDatabase
, neither whether it is a good practice to implement, neither how to alternatively do it...
What I tried was the following:
MyDatabase.getDatabaseInstance(MyApplication.getAppContext()).getOpenHelper().getWritableDatabase().insert(currentTable, CONFLICT_NONE, rowValues);
Is it okey? Where should I call it from? ViewModel
? A new DAO
? How shall I do it?
Thanks.