WatchNextProgram
class WatchNextProgram
A convenience class to access 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 types |
|---|
class WatchNextProgram.BuilderThis Builder class simplifies the creation of a |
Constants |
|
|---|---|
const Array<String!> |
The projection for a |
const Int |
The unknown watch next type. |
Public functions |
|
|---|---|
Boolean |
|
java-static WatchNextProgram! |
fromCursor(cursor: Cursor!)Creates a WatchNextProgram object from a cursor including the fields defined in |
Long |
|
Int |
|
Boolean |
hasAnyUpdatedValues(update: WatchNextProgram!)Indicates whether some other WatchNextProgram has any set attribute that is different from this WatchNextProgram's respective attributes. |
ContentValues! |
|
String! |
toString() |
Constants
PROJECTION
const val PROJECTION: Array<String!>
The projection for a WatchNextProgram query.
This provides a array of strings containing the columns to be used in the query and in creating a Cursor object, which is used to iterate through the rows in the table.
WATCH_NEXT_TYPE_UNKNOWN
const val WATCH_NEXT_TYPE_UNKNOWN = -1: Int
The unknown watch next type. Use this type when the actual type is not known.
Public functions
fromCursor
java-static fun fromCursor(cursor: Cursor!): WatchNextProgram!
Creates a WatchNextProgram object from a cursor including the fields defined in WatchNextPrograms.
| Parameters | |
|---|---|
cursor: Cursor! |
A row from the TV Input Framework database. |
| Returns | |
|---|---|
WatchNextProgram! |
A Program with the values taken from the cursor. |
getLastEngagementTimeUtcMillis
fun getLastEngagementTimeUtcMillis(): Long
| Returns | |
|---|---|
Long |
The value of |
getWatchNextType
fun getWatchNextType(): Int
| Returns | |
|---|---|
Int |
The value of |
hasAnyUpdatedValues
fun hasAnyUpdatedValues(update: WatchNextProgram!): Boolean
Indicates whether some other WatchNextProgram has any set attribute that is different from this WatchNextProgram's respective attributes. An attribute is considered "set" if its key is present in the ContentValues vector.
toContentValues
fun toContentValues(): ContentValues!
| Returns | |
|---|---|
ContentValues! |
The fields of the Program in the ContentValues format to be easily inserted into the TV Input Framework database. |