class Program : Comparable


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 types

This Builder class simplifies the creation of a Program object.

Public functions

compareTo

Added in 1.1.0-alpha02
fun compareTo(other: Program): Int
Parameters
other: Program

The program you're comparing to.

Returns
Int

The chronological order of the programs.

equals

fun equals(other: Any!): Boolean

fromCursor

Added in 1.1.0-alpha02
java-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.

Returns
Program!

A Program with the values taken from the cursor.

getAudioLanguages

Added in 1.1.0-alpha02
fun getAudioLanguages(): Array<String!>!
Returns
Array<String!>!

The audio languages for the program.

getBroadcastGenres

Added in 1.1.0-alpha02
fun getBroadcastGenres(): Array<String!>!
Returns
Array<String!>!

The value of COLUMN_BROADCAST_GENRE for the program.

getCanonicalGenres

Added in 1.1.0-alpha02
fun getCanonicalGenres(): Array<String!>!
Returns
Array<String!>!

The canonical genre for the program.

getChannelId

Added in 1.1.0-alpha02
fun getChannelId(): Long
Returns
Long

The value of COLUMN_CHANNEL_ID for the program.

getContentRatings

Added in 1.1.0-alpha02
fun getContentRatings(): Array<TvContentRating!>!
Returns
Array<TvContentRating!>!

The content rating for the program.

getDescription

Added in 1.1.0-alpha02
fun getDescription(): String!
Returns
String!

The short description for the program.

getEndTimeUtcMillis

Added in 1.1.0-alpha02
fun getEndTimeUtcMillis(): Long
Returns
Long

The value of COLUMN_END_TIME_UTC_MILLIS for the program.

getEpisodeNumber

Added in 1.1.0-alpha02
fun getEpisodeNumber(): String!
Returns
String!

The episode display number for the program.

getEpisodeTitle

Added in 1.1.0-alpha02
fun getEpisodeTitle(): String!
Returns
String!

The episode title for the program.

getEventId

Added in 1.1.0-alpha02
fun getEventId(): Int

Returns the value of COLUMN_EVENT_ID for the program.

No-op on devices prior to R.

getGlobalContentId

Added in 1.1.0-alpha02
fun getGlobalContentId(): String?

Returns the value of COLUMN_GLOBAL_CONTENT_ID for the program.

No-op on devices prior to R.

getId

Added in 1.1.0-alpha02
fun getId(): Long
Returns
Long

The ID for the program.

See also
_ID

getInternalProviderDataByteArray

Added in 1.1.0-alpha02
fun getInternalProviderDataByteArray(): ByteArray<Byte>!
Returns
ByteArray<Byte>!

The internal provider data for the program.

getInternalProviderFlag1

Added in 1.1.0-alpha02
fun getInternalProviderFlag1(): Long!
Returns
Long!

The first internal provider flag for the program.

getInternalProviderFlag2

Added in 1.1.0-alpha02
fun getInternalProviderFlag2(): Long!
Returns
Long!

The second internal provider flag for the program.

getInternalProviderFlag3

Added in 1.1.0-alpha02
fun getInternalProviderFlag3(): Long!
Returns
Long!

The third internal provider flag for the program.

getInternalProviderFlag4

Added in 1.1.0-alpha02
fun getInternalProviderFlag4(): Long!
Returns
Long!

The forth internal provider flag for the program.

getLongDescription

Added in 1.1.0-alpha02
fun getLongDescription(): String!
Returns
String!

The long description for the program.

getPosterArtUri

Added in 1.1.0-alpha02
fun getPosterArtUri(): Uri!
Returns
Uri!

The poster art URI for the program.

getReviewRating

Added in 1.1.0-alpha02
fun getReviewRating(): String!
Returns
String!

The review rating for the program.

getReviewRatingStyle

Added in 1.1.0-alpha02
fun getReviewRatingStyle(): Int
Returns
Int

The review rating style for the program.

getSeasonNumber

Added in 1.1.0-alpha02
fun getSeasonNumber(): String!
Returns
String!

The season display number for the program.

getSeasonTitle

Added in 1.1.0-alpha02
fun getSeasonTitle(): String!
Returns
String!

The season title for the program.

getSeriesId

Added in 1.1.0-alpha02
fun getSeriesId(): String?
Returns
String?

The series ID for the program.

See also
COLUMN_SERIES_ID

getStartTimeUtcMillis

Added in 1.1.0-alpha02
fun getStartTimeUtcMillis(): Long
Returns
Long

The value of COLUMN_START_TIME_UTC_MILLIS for the program.

getThumbnailUri

Added in 1.1.0-alpha02
fun getThumbnailUri(): Uri!
Returns
Uri!

The thumbnail URI for the program.

getTitle

Added in 1.1.0-alpha02
fun getTitle(): String!
Returns
String!

The title for the program.

See also
COLUMN_TITLE

getVideoHeight

Added in 1.1.0-alpha02
fun getVideoHeight(): Int
Returns
Int

The video height for the program.

getVideoWidth

Added in 1.1.0-alpha02
fun getVideoWidth(): Int
Returns
Int

The video width for the program.

hashCode

fun hashCode(): Int

isRecordingProhibited

Added in 1.1.0-alpha02
fun isRecordingProhibited(): Boolean
Returns
Boolean

The value of COLUMN_RECORDING_PROHIBITED for the program.

isSearchable

Added in 1.1.0-alpha02
fun isSearchable(): Boolean
Returns
Boolean

Whether the program is searchable or not.

toContentValues

Added in 1.1.0-alpha02
fun toContentValues(): ContentValues!
Returns
ContentValues!

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

toString

fun toString(): String!