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

PreviewProgram

public final class PreviewProgram
extends Object

java.lang.Object
   ↳ android.support.media.tv.PreviewProgram


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

This class makes it easy to insert or retrieve a preview program from the system content provider, which is defined in TvContractCompat.

Usage example when inserting a preview program:

 PreviewProgram previewProgram = new PreviewProgram.Builder()
         .setChannelId(channel.getId())
         .setType(PreviewPrograms.TYPE_MOVIE)
         .setTitle("Program Title")
         .setDescription("Program Description")
         .setPosterArtUri(Uri.parse("http://example.com/poster_art.png"))
         // Set more attributes...
         .build();
 Uri previewProgramUri = getContentResolver().insert(PreviewPrograms.CONTENT_URI,
         previewProgram.toContentValues());
 

Usage example when retrieving a preview program:

 PreviewProgram previewProgram;
 try (Cursor cursor = resolver.query(previewProgramUri, null, null, null, null)) {
     if (cursor != null && cursor.getCount() != 0) {
         cursor.moveToNext();
         previewProgram = PreviewProgram.fromCursor(cursor);
     }
 }
 

Usage example when updating an existing preview program:

 PreviewProgram updatedProgram = new PreviewProgram.Builder(previewProgram)
         .setWeight(20)
         .build();
 getContentResolver().update(TvContractCompat.buildPreviewProgramUri(updatedProgram.getId()),
         updatedProgram.toContentValues(), null, null);
 

Usage example when deleting a preview program:

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

Summary

Nested classes

class PreviewProgram.Builder

This Builder class simplifies the creation of a PreviewProgram object. 

Public methods

boolean equals(Object other)
static PreviewProgram fromCursor(Cursor cursor)

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

String[] getAudioLanguages()
String getAuthor()
int getAvailability()
String[] getCanonicalGenres()
long getChannelId()
String getContentId()
TvContentRating[] getContentRatings()
String getDescription()
int getDurationMillis()
long getEndTimeUtcMillis()
String getEpisodeNumber()
String getEpisodeTitle()
String getGenre()
long getId()
Intent getIntent()
Uri getIntentUri()
long getInteractionCount()
int getInteractionType()
byte[] getInternalProviderDataByteArray()
Long getInternalProviderFlag1()
Long getInternalProviderFlag2()
Long getInternalProviderFlag3()
Long getInternalProviderFlag4()
String getInternalProviderId()
int getItemCount()
int getLastPlaybackPositionMillis()
String getLogoContentDescription()
Uri getLogoUri()
String getLongDescription()
String getOfferPrice()
int getPosterArtAspectRatio()
Uri getPosterArtUri()
Uri getPreviewAudioUri()
Uri getPreviewVideoUri()
String getReleaseDate()
String getReviewRating()
int getReviewRatingStyle()
String getSeasonNumber()
String getSeasonTitle()
long getStartTimeUtcMillis()
String getStartingPrice()
int getThumbnailAspectRatio()
Uri getThumbnailUri()
String getTitle()
int getType()
int getVideoHeight()
int getVideoWidth()
int getWeight()
int hashCode()
boolean isBrowsable()
boolean isLive()
boolean isSearchable()
boolean isTransient()
ContentValues toContentValues()
String toString()

Inherited methods

From class java.lang.Object

Public methods

equals

added in version 26.1.0
boolean equals (Object other)

Parameters
other Object

Returns
boolean

fromCursor

added in version 26.1.0
PreviewProgram fromCursor (Cursor cursor)

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

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

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

getAudioLanguages

String[] getAudioLanguages ()

Returns
String[] The audio languages for the program.

getAuthor

String getAuthor ()

Returns
String The author for the program.

See also:

getAvailability

int getAvailability ()

Returns
int The availability of 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.

getContentId

String getContentId ()

Returns
String The content ID for the program.

See also:

getContentRatings

TvContentRating[] getContentRatings ()

Returns
TvContentRating[] The content rating for the program.

getDescription

String getDescription ()

Returns
String The short description for the program.

getDurationMillis

int getDurationMillis ()

Returns
int The duration of the program in millis.

getEndTimeUtcMillis

long getEndTimeUtcMillis ()

Returns
long The end time 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.

getGenre

String getGenre ()

Returns
String The genre for the program.

See also:

getId

long getId ()

Returns
long The ID for the program.

See also:

getIntent

Intent getIntent ()

Returns
Intent The intent which is launched when the program is selected.

Throws
URISyntaxException

See also:

getIntentUri

Uri getIntentUri ()

Returns
Uri The intent URI which is launched when the program is selected.

See also:

getInteractionCount

long getInteractionCount ()

Returns
long The interaction count for the program.

getInteractionType

int getInteractionType ()

Returns
int The interaction type for the program.

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.

getInternalProviderId

String getInternalProviderId ()

Returns
String The internal provider ID for the program.

getItemCount

int getItemCount ()

Returns
int The item count for the program.

See also:

getLastPlaybackPositionMillis

int getLastPlaybackPositionMillis ()

Returns
int The last playback position of the program in millis.

getLogoContentDescription

String getLogoContentDescription ()

Returns
String The logo content description for the program.

getLogoUri

Uri getLogoUri ()

Returns
Uri The logo URI for the program.

See also:

getLongDescription

String getLongDescription ()

Returns
String The long description for the program.

getOfferPrice

String getOfferPrice ()

Returns
String The offer price of the program.

See also:

getPosterArtAspectRatio

int getPosterArtAspectRatio ()

Returns
int The poster art aspect ratio for the program.

getPosterArtUri

Uri getPosterArtUri ()

Returns
Uri The poster art URI for the program.

getPreviewAudioUri

Uri getPreviewAudioUri ()

Returns
Uri The preview audio URI for the program.

getPreviewVideoUri

Uri getPreviewVideoUri ()

Returns
Uri The preview video URI for the program.

getReleaseDate

String getReleaseDate ()

Returns
String The release date of 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

long getStartTimeUtcMillis ()

Returns
long The start time for the program.

getStartingPrice

String getStartingPrice ()

Returns
String The starting price of the program.

getThumbnailAspectRatio

int getThumbnailAspectRatio ()

Returns
int The thumbnail aspect ratio 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:

getType

int getType ()

Returns
int The type of 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:

getWeight

added in version 26.1.0
int getWeight ()

Returns
int The value of COLUMN_WEIGHT for the program.

hashCode

int hashCode ()

Returns
int

isBrowsable

boolean isBrowsable ()

Returns
boolean Whether the program is browsable or not.

See also:

isLive

boolean isLive ()

Returns
boolean Whether the program is live or not.

See also:

isSearchable

boolean isSearchable ()

Returns
boolean Whether the program is searchable or not.

See also:

isTransient

boolean isTransient ()

Returns
boolean Whether the program is transient 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