Use pre-populated databases with Realm

后端 未结 2 1809
余生分开走
余生分开走 2021-02-15 16:15

How could we convert SQLite database to a Realm database?

Is there any way to use pre-populated databases with Realm on Android?

2条回答
  •  天涯浪人
    2021-02-15 16:44

    Currently there is no way to automatically convert a SQLite database to a Realm database, you would have to manually read all data from the SQLite database and insert them into Realm.

    An alternative could be the Realm browser that might make this easier, but it is currently available for MacOS X only. You can read more here: https://github.com/realm/realm-java/issues/435

    For the second part: As Realm databases are just a single file so you can easily add a pre-populated realm database to you app and reference it with Realm.getInstance().

提交回复
热议问题