Created
December 29, 2017 10:18
-
-
Save nguyenlinhnttu/44df545584f2ed7d09cdf1933788ef42 to your computer and use it in GitHub Desktop.
Sample Query SQLite Kotlin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun getListCat(): ArrayList<ItemMenu> { | |
var query = "SELECT * FROM " + CATEGORY | |
var cursor :Cursor = database.rawQuery(query, null) | |
var arrCategory = ArrayList<ItemMenu>() | |
if (cursor.moveToFirst()) { | |
do { | |
var item = ItemMenu(cursor.getString(0), cursor.getString(1)) | |
arrCategory.add(item) | |
} while (cursor.moveToNext()) | |
} | |
cursor.close() | |
return arrCategory | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment