i have a kotlin app, and a function which counts games in a database. however, when i put the value in an acitivity, it returns 0. fun countGames(): Int {
var gamesCount = 0
val COUNT_GAMES = (“SELECT COUNT(*) FROM " + TABLE_GAMES + " WHERE " + COLUMN_TYPE + " = 0”)
val DB = this.readableDatabase
val QUERY = DB.rawQuery(COUNT_GAMES, null)
while (QUERY.moveToNext()) {
gamesCount = Integer.parseInt(QUERY.getString(0))
}
QUERY.close()
DB.close()
return gamesCount
}