Constantly
Adverb
★
all the time or often
總是;經常地,不斷地
She has the TV on constantly.
她總是開著電視。
他的想法時常在變。
這裡有我的遊戲經驗,攻略,跑online教學分享. 最重要的是::所有最新的AKB48資訊都會更新在這裡,所以喜歡AKB系列的朋友們,快點訂閱我的小格吧!!!❤希望你們喜歡❤
因為每台手機的存取位址不一樣,所以我們不能直接寫死
//val DB_PATH = "/data/data/com.example.last_win/databases" //在手机里存放数据库的位置//val dbfile = "$DB_PATH/ingerdients.db"
像是上面那樣把路徑給寫死, 手機就會發生閃退的情況 !!
★getDatabasePath>>取得手機裡面有 ingerdients.db 檔案的路徑!!
val db = File(getDatabasePath("ingerdients.db").getPath()) //Get the file name of the databaseval dbdir: File = db.getParentFile() if (!dbdir.exists()) { dbdir.mkdirs() } Toast.makeText(this, getDatabasePath("ingerdients.db").getPath(), LENGTH_LONG).show() //执行数据库导入val myInput = applicationContext.assets.open("ingerdients.db") //assets.open("ingerdients.db") //欲导入的数据库val myOutput = FileOutputStream(db) val buffer = ByteArray(1024) var length: Int = myInput.read(buffer) while ((length) > 0) { myOutput.write(buffer, 0, length) length = myInput.read(buffer) } myOutput.flush() myInput.close() myOutput.close()