This class makes it easy to insert or retrieve a program from the system content provider,
which is defined in TvContractCompat.
Usage example when inserting a program:
Program program = new Program.Builder()
.setChannelId(channel.getId())
.setTitle("Program Title")
.setDescription("Program Description")
.setPosterArtUri(Uri.parse("http://example.com/poster_art.png"))
// Set more attributes...
.build();
Uri programUri = getContentResolver().insert(Programs.CONTENT_URI, program.toContentValues());
Usage example when retrieving a program:
Program program;
try (Cursor cursor = resolver.query(programUri, null, null, null, null)) {
if (cursor != null && cursor.getCount() != 0) {
cursor.moveToNext();
program = Program.fromCursor(cursor);
}
}
Usage example when updating an existing program:
Program updatedProgram = new Program.Builder(program)
.setEndTimeUtcMillis(newProgramEndTime)
.build();
getContentResolver().update(TvContractCompat.buildProgramUri(updatedProgram.getId()),
updatedProgram.toContentValues(), null, null);
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]