Program

class Program : BaseProgram, Comparable<Program!>
androidx.tvprovider.media.tv.Program

A convenience class to access TvContractCompat.Programs entries in the system content provider.

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); 

Usage example when deleting a program:

 getContentResolver().delete(TvContractCompat.buildProgramUri(existingProgram.getId()), null, null); 

Summary

Nested classes

This Builder class simplifies the creation of a Program object.

Public methods
Boolean

Long

Long

Long

Int

Boolean
equals(other: Any?)

String

Int
compareTo(@NonNull other: Program)

ContentValues!

Array<String!>!

static Program!
fromCursor(cursor: Cursor!)

Creates a Program object from a cursor including the fields defined in Programs.

Public methods

isRecordingProhibited

fun isRecordingProhibited(): Boolean
Return
Boolean: The value of Programs#COLUMN_RECORDING_PROHIBITED for the program.

getStartTimeUtcMillis

fun getStartTimeUtcMillis(): Long
Return
Long: The value of Programs#COLUMN_START_TIME_UTC_MILLIS for the program.

getChannelId

fun getChannelId(): Long
Return
Long: The value of Programs#COLUMN_CHANNEL_ID for the program.

getEndTimeUtcMillis

fun getEndTimeUtcMillis(): Long
Return
Long: The value of Programs#COLUMN_END_TIME_UTC_MILLIS for the program.

hashCode

fun hashCode(): Int

equals

fun equals(other: Any?): Boolean

toString

fun toString(): String

compareTo

fun compareTo(@NonNull other: Program): Int
Parameters
other Program: The program you're comparing to.
Return
Int: The chronological order of the programs.

toContentValues

fun toContentValues(): ContentValues!
Return
ContentValues!: The fields of the Program in the ContentValues format to be easily inserted into the TV Input Framework database.

getBroadcastGenres

fun getBroadcastGenres(): Array<String!>!
Return
Array<String!>!: The value of Programs#COLUMN_BROADCAST_GENRE for the program.

fromCursor

static fun fromCursor(cursor: Cursor!): Program!

Creates a Program object from a cursor including the fields defined in Programs.

Parameters
cursor Cursor!: A row from the TV Input Framework database.
Return
Program!: A Program with the values taken from the cursor.