简体   繁体   English

如何使用带有Kotlin的ORM室的Android应用程序使用现有数据库

[英]How to use an existing database with an Android application using room ORM with Kotlin

My project has some initializes data so I have already create a sqlite database with navicat application. 我的项目有一些初始化数据,因此我已经用navicat应用程序创建了一个sqlite数据库。 I use kotlin instead of java and use room ORM too (android-architecture-components). 我使用kotlin而不是Java,还使用了房间ORM(android-architecture-components)。 how can i copy my database too my project from asset folder without any problem? 我如何从资产文件夹中复制数据库以及项目呢?

referring to this question , you have just make sure of having same db schema in order to do that. 提到这个问题,您只需确保具有相同的数据库架构即可。 and to copy file to /database folder in internal app storage there is plenty of resources and example just search. 并将文件复制到内部应用程序存储中的/database文件夹中,有很多资源,例如搜索。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM