Last active
February 22, 2023 21:34
-
-
Save ademirqueiroga/be780f7754ec2db2e5d6016ecda4c7cd to your computer and use it in GitHub Desktop.
Querying channel info with ContentResolver
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
private fun queryChannels(): List<Channel> { | |
val channels = ArrayList<Channel>() | |
context.contentResolver.query( | |
/* uri = */ TvContractCompat.Channels.CONTENT_URI, | |
/* projection = */ Channel.PROJECTION, | |
/* selection = */ null, | |
/* selectionArgs = */ null, | |
/* sortOrder = */ null | |
).use { cursor -> | |
while (cursor != null && cursor.moveToNext()) { | |
channels.add(Channel.fromCursor(cursor)) | |
} | |
} | |
return channels | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment