Closing the cursor

Report a typo

Write the missing line of code to close your open resources.

val cursor = db.query(
    "chats", null, "id = ?", arrayOf(id.toString()), null, null, null
)
try {
    if (cursor.moveToFirst()) return Chat(cursor)
} finally {
    // Write the missing line of code
}
return null
Enter a short text
___

Create a free account to access the full topic