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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-11 UTC."],[],[]]