Title
h

Hammad

07/12/2018, 3:48 PM
[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?
private fun copyDatabase() {
        ctx.assets.open(DB_NAME).buffered().use { input ->
            ctx.getDatabasePath(DB_NAME).outputStream().buffered().use { output ->
                input.copyTo(output, 1024)
            }
        }
    }
a

Alin B.

07/12/2018, 4:05 PM
h

Hammad

07/12/2018, 4:39 PM
@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