belongs to Maven artifact com.android.support:support-tv-provider:28.0.0-alpha1
WatchNextProgram
public
final
class
WatchNextProgram
extends Object
java.lang.Object | |
↳ | android.support.media.tv.WatchNextProgram |
A convenience class to access TvContractCompat.WatchNextPrograms
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 "watch next" program:
WatchNextProgram watchNextProgram = new WatchNextProgram.Builder() .setWatchNextType(WatchNextPrograms.WATCH_NEXT_TYPE_CONTINUE) .setType(PreviewPrograms.TYPE_MOVIE) .setTitle("Program Title") .setDescription("Program Description") .setPosterArtUri(Uri.parse("http://example.com/poster_art.png")) // Set more attributes... .build(); Uri watchNextProgramUri = getContentResolver().insert(WatchNextPrograms.CONTENT_URI, watchNextProgram.toContentValues());
Usage example when retrieving a "watch next" program:
WatchNextProgram watchNextProgram; try (Cursor cursor = resolver.query(watchNextProgramUri, null, null, null, null)) { if (cursor != null && cursor.getCount() != 0) { cursor.moveToNext(); watchNextProgram = WatchNextProgram.fromCursor(cursor); } }
Usage example when updating an existing "watch next" program:
WatchNextProgram updatedProgram = new WatchNextProgram.Builder(watchNextProgram) .setLastEngagementTimeUtcMillis(System.currentTimeMillis()) .build(); getContentResolver().update(TvContractCompat.buildWatchNextProgramUri(updatedProgram.getId()), updatedProgram.toContentValues(), null, null);
Usage example when deleting a "watch next" program:
getContentResolver().delete(TvContractCompat.buildWatchNextProgramUri(existingProgram.getId()), null, null);
Summary
Nested classes | |
---|---|
class |
WatchNextProgram.Builder
This Builder class simplifies the creation of a |
Constants | |
---|---|
int |
WATCH_NEXT_TYPE_UNKNOWN
The unknown watch next type. |
Inherited methods | |
---|---|
![]()
java.lang.Object
|
Constants
WATCH_NEXT_TYPE_UNKNOWN
int WATCH_NEXT_TYPE_UNKNOWN
The unknown watch next type. Use this type when the actual type is not known.
Constant Value: -1 (0xffffffff)
Public methods
equals
boolean equals (Object other)
Parameters | |
---|---|
other |
Object |
Returns | |
---|---|
boolean |
fromCursor
WatchNextProgram fromCursor (Cursor cursor)
Creates a WatchNextProgram object from a cursor including the fields defined in
TvContractCompat.WatchNextPrograms
.
Parameters | |
---|---|
cursor |
Cursor : A row from the TV Input Framework database. |
Returns | |
---|---|
WatchNextProgram |
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:
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:
getEpisodeNumber
String getEpisodeNumber ()
Returns | |
---|---|
String |
The episode display number for the program. |
See also:
getEpisodeTitle
String getEpisodeTitle ()
Returns | |
---|---|
String |
The episode title for the program. |
See also:
getIntent
Intent getIntent ()
Returns | |
---|---|
Intent |
The intent which is launched when the program is selected. |
Throws | |
---|---|
URISyntaxException |
See also: