![](/img/trans.png)
[英]How can I parse a local JSON file from assets folder into a ListView?
[英]Is there any way that I can read database file from local computer (local server) and copy to assets folder in android?
@Singleton
@Provides
fun provideDB(applicationContext: Context): myDB{
return Room.databaseBuilder(applicationContext, myDB::class.java, DatabaseConstants.DATABASE)
.createFromAsset("sample2.db")
.fallbackToDestructiveMigration()
.build()
}
這是我從資產文件夾中讀取 sample2.db 的代碼。 我想從本地服務器讀取它並將其粘貼到資產文件夾,以便我可以在運行時使用它的方式使用它。 應用程序應從本地服務器讀取文件並粘貼到資產文件夾或更新文件(如果已存在)。
如果這是您的要求,則您無法在運行時將某些內容復制到資產文件夾中。 您需要下載文件,然后在運行時將其存儲在文件系統中
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.