[SOLVED] Copying my sqlite db file from assets to ...
# android
h
[SOLVED] Copying my sqlite db file from assets to database path ends up blank with only a single table android_metadata. What am I doing wrong here?
Copy code
private fun copyDatabase() {
        ctx.assets.open(DB_NAME).buffered().use { input ->
            ctx.getDatabasePath(DB_NAME).outputStream().buffered().use { output ->
                input.copyTo(output, 1024)
            }
        }
    }
a
h
@Alin B. was trying to go more true Kotlin style. That seems to be almost java converted to Kotlin. I tried it and end up with the same issue.
Solved it. Needed to do the createOrOpen first!
👍 1
143 Views