0

I am trying to get writable database using DBFlow using the FlowManager like this FlowManager.getDatabase(SampleDatabase.NAME).getWritableDatabase() using DBFlow version "4.0.0-beta1" but i get an error DatabaseWrapper cannot be converted to SQLiteDatabase. I found an issue on Github Can't use existing SQLite database but i cant understand what it means. I really need to do this will be grateful for any help.

christoandrew
  • 437
  • 4
  • 17

1 Answers1

0

This means that the FlowManager.getDatabase(SampleDatabase.NAME).getWritableDatabase() method does not return a SQLiteDatabase object like SQLiteOpenHelper.getWriteableDatabase(). Instead, it will return an instance of DatabaseWrapper class.

If you need direct access to the database, you should be able to get the file path to the database file using FlowManager.getDatabase(SampleDatabase.NAME).getDatabaseFileName(). Use this path to open your database using the Android API. However, this is definitely not the recommended way of using DBFlow and maybe leads to unexpected behaviour.

NiThDi
  • 1,007
  • 1
  • 9
  • 22