added in version 26.1.0
belongs to Maven artifact com.android.support:support-tv-provider:28.0.0-alpha1

Program

public final class Program
extends Object implements Comparable<Program>

java.lang.Object
   ↳ android.support.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()
long getId()
byte[] getInternalProviderDataByteArray()
Long getInternalProviderFlag1()
Long getInternalProviderFlag2()
Long getInternalProviderFlag3()
Long getInternalProviderFlag4()
String getLongDescription()
Uri getPosterArtUri()
String getReviewRating()
int getReviewRatingStyle()
String getSeasonNumber()
String getSeasonTitle()
long getStartTimeUtcMillis()
Uri getThumbnailUri()
String getTitle()
int getVideoHeight()
int getVideoWidth()
int hashCode()
boolean isRecordingProhibited()
boolean isSearchable()
ContentValues toContentValues()
String toString()

Inherited methods

From class java.lang.Object
From interface java.lang.Comparable

Public methods

compareTo

added in version 26.1.0
int compareTo (Program other)

Parameters
other Program: The program you're comparing to.

Returns
int The chronological order of the programs.

equals

added in version 26.1.0
boolean equals (Object other)

Parameters
other Object

Returns
boolean

fromCursor

added in version 26.1.0
Program fromCursor (Cursor cursor)

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

Parameters
cursor Cursor: A row from the TV Input Framework database.

Returns
Program A Program with the values taken from the cursor.

getAudioLanguages

String[] getAudioLanguages ()

Returns
String[] The audio languages for the program.

getBroadcastGenres

added in version 26.1.0
String[] getBroadcastGenres ()

Returns
String[] The value of COLUMN_BROADCAST_GENRE for the program.

getCanonicalGenres

String[] getCanonicalGenres ()

Returns
String[] The canonical genre for the program.

getChannelId

added in version 26.1.0
long getChannelId ()

Returns
long The value of COLUMN_CHANNEL_ID for the program.

getContentRatings

TvContentRating[] getContentRatings ()

Returns
TvContentRating[] The content rating for the program.

getDescription

String getDescription ()

Returns
String The short description for the program.

getEndTimeUtcMillis

added in version 26.1.0
long getEndTimeUtcMillis ()

Returns
long The value of COLUMN_END_TIME_UTC_MILLIS for the program.

getEpisodeNumber

String getEpisodeNumber ()

Returns
String The episode display number for the program.

getEpisodeTitle

String getEpisodeTitle ()

Returns
String The episode title for the program.

getId

long getId ()

Returns
long The ID for the program.

See also:

getInternalProviderDataByteArray

byte[] getInternalProviderDataByteArray ()

Returns
byte[] The internal provider data for the program.

getInternalProviderFlag1

Long getInternalProviderFlag1 ()

Returns
Long The first internal provider flag for the program.

getInternalProviderFlag2

Long getInternalProviderFlag2 ()

Returns
Long The second internal provider flag for the program.

getInternalProviderFlag3

Long getInternalProviderFlag3 ()

Returns
Long The third internal provider flag for the program.

getInternalProviderFlag4

Long getInternalProviderFlag4 ()

Returns
Long The forth internal provider flag for the program.

getLongDescription

String getLongDescription ()

Returns
String The long description for the program.

getPosterArtUri

Uri getPosterArtUri ()

Returns
Uri The poster art URI for the program.

getReviewRating

String getReviewRating ()

Returns
String The review rating for the program.

getReviewRatingStyle

int getReviewRatingStyle ()

Returns
int The review rating style for the program.

getSeasonNumber

String getSeasonNumber ()

Returns
String The season display number for the program.

getSeasonTitle

String getSeasonTitle ()

Returns
String The season title for the program.

getStartTimeUtcMillis

added in version 26.1.0
long getStartTimeUtcMillis ()

Returns
long The value of COLUMN_START_TIME_UTC_MILLIS for the program.

getThumbnailUri

Uri getThumbnailUri ()

Returns
Uri The thumbnail URI for the program.

getTitle

String getTitle ()

Returns
String The title for the program.

See also:

getVideoHeight

int getVideoHeight ()

Returns
int The video height for the program.

getVideoWidth

int getVideoWidth ()

Returns
int The video width for the program.

See also:

hashCode

added in version 26.1.0
int hashCode ()

Returns
int

isRecordingProhibited

added in version 26.1.0
boolean isRecordingProhibited ()

Returns
boolean The value of COLUMN_RECORDING_PROHIBITED for the program.

isSearchable

boolean isSearchable ()

Returns
boolean Whether the program is searchable or not.

See also:

toContentValues

added in version 26.1.0
ContentValues toContentValues ()

Returns
ContentValues The fields of the Program in the ContentValues format to be easily inserted into the TV Input Framework database.

toString

added in version 26.1.0
String toString ()

Returns
String