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 |
Inherited methods | |
---|---|
![]()
java.lang.Object
|
Public methods
equals
boolean equals (Object other)
Parameters | |
---|---|
other |
Object |
Returns | |
---|---|
boolean |
fromCursor
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. |
See also:
getAvailability
int getAvailability ()
Returns | |
---|---|
int |
The availability of the program. |
See also:
getCanonicalGenres
String[] getCanonicalGenres ()
Returns | |
---|---|
String[] |
The canonical genre for the program. |
See also:
getChannelId
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. |
See also:
getDescription
String getDescription ()
Returns | |
---|---|
String |
The short description for the program. |
See also:
getDurationMillis
int getDurationMillis ()
Returns | |
---|---|
int |
The duration of the program in millis. |
See also:
getEndTimeUtcMillis
long getEndTimeUtcMillis ()
Returns | |
---|---|
long |
The end time for the program. |
See also: