PreviewProgram

public final class PreviewProgram
extends Object

java.lang.Object
   ↳ androidx.tvprovider.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()
String getSeriesId()