Program

public final class Program
extends Object implements Comparable<Program>

java.lang.Object
   ↳ 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

class Program.Builder

This Builder class simplifies the creation of a Program object. 

Public methods

int compareTo(Program other)
boolean equals(Object other)
static Program fromCursor(Cursor cursor)

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

String[] getAudioLanguages()
String[] getBroadcastGenres()
String[] getCanonicalGenres()
long getChannelId()
TvContentRating[] getContentRatings()
String getDescription()
long getEndTimeUtcMillis()
String getEpisodeNumber()
String getEpisodeTitle()
int getEventId()

Returns the value of TvContractCompat.Programs.COLUMN_EVENT_ID for the program.

String getGlobalContentId()

Returns the value of TvContractCompat.Programs.COLUMN_GLOBAL_CONTENT_ID for the program.

long getId()
byte[] getInternalProviderDataByteArray()
Long getInternalProviderFlag1()
Long getInternalProviderFlag2()
Long getInternalProviderFlag3()
Long getInternalProviderFlag4()
String getLongDescription()
Uri getPosterArtUri()
String getReviewRating()
int getReviewRatingStyle()
String getSeasonNumber()
String getSeasonTitle()
String getSeriesId()
long getStartTimeUtcMillis()
Uri getThumbnailUri()
String getTitle()
int getVideoHeight()
int getVideoWidth()
int hashCode()
boolean isRecordingProhibited()
boolean isSearchable()
ContentValues toContentValues()
String toString()

Inherited methods