# WatchNextProgram

Artifact: [androidx.tvprovider:tvprovider](https://developer.android.com/jetpack/androidx/releases/tvprovider) [View Source](https://cs.android.com/search?q=file:androidx/tvprovider/media/tv/WatchNextProgram.java+class:androidx.tvprovider.media.tv.WatchNextProgram) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/tvprovider#1.1.0)

*** ** * ** ***


```
class WatchNextProgram
```

<br />

*** ** * ** ***

A convenience class to access `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/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 `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/TvContractCompat`.

Usage example when inserting a "watch next" program:

```kotlin
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:

```kotlin
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:

```kotlin
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:

```kotlin
getContentResolver().delete(TvContractCompat.buildWatchNextProgramUri(existingProgram.getId()),
        null, null);
```

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram.Builder` This Builder class simplifies the creation of a `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram` object. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram#PROJECTION()` The projection for a `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram` query. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram#WATCH_NEXT_TYPE_UNKNOWN() = -1` The unknown watch next type. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` |
| `java-static https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram!` | `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram#fromCursor(android.database.Cursor)(cursor: https://developer.android.com/reference/android/database/Cursor.html!)` Creates a WatchNextProgram object from a cursor including the fields defined in `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/TvContractCompat.WatchNextPrograms`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram#getLastEngagementTimeUtcMillis()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram#getWatchNextType()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram#hasAnyUpdatedValues(androidx.tvprovider.media.tv.WatchNextProgram)(update: https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram!)` Indicates whether some other WatchNextProgram has any set attribute that is different from this WatchNextProgram's respective attributes. |
| `https://developer.android.com/reference/android/content/ContentValues.html!` | `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram#toContentValues()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram#toString()()` |

## Constants

### PROJECTION

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/tvprovider#1.1.0)

```
const val PROJECTION: Array<String!>
```

The projection for a `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/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

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/tvprovider#1.1.0)

```
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

### equals

```
fun equals(other: Any!): Boolean
```

### fromCursor

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/tvprovider#1.1.0)

```
java-static fun fromCursor(cursor: Cursor!): WatchNextProgram!
```

Creates a WatchNextProgram object from a cursor including the fields defined in `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/TvContractCompat.WatchNextPrograms`.

| Parameters |
|---|---|
| `cursor: https://developer.android.com/reference/android/database/Cursor.html!` | A row from the TV Input Framework database. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram!` | A Program with the values taken from the cursor. |

### getLastEngagementTimeUtcMillis

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/tvprovider#1.1.0)

```
fun getLastEngagementTimeUtcMillis(): Long
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The value of `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/TvContractCompat.WatchNextPrograms#COLUMN_LAST_ENGAGEMENT_TIME_UTC_MILLIS()` for the program. |

### getWatchNextType

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/tvprovider#1.1.0)

```
fun getWatchNextType(): Int
```

Value is one of the following:

- `WatchNextPrograms.WATCH_NEXT_TYPE_CONTINUE`
- `WatchNextPrograms.WATCH_NEXT_TYPE_NEXT`
- `WatchNextPrograms.WATCH_NEXT_TYPE_NEW`
- `WatchNextPrograms.WATCH_NEXT_TYPE_WATCHLIST`

<br />

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The value of `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/TvContractCompat.WatchNextPrograms#COLUMN_WATCH_NEXT_TYPE()` for the program, or `https://developer.android.com/reference/kotlin/androidx/tvprovider/media/tv/WatchNextProgram#WATCH_NEXT_TYPE_UNKNOWN()` if it's unknown. |

### hasAnyUpdatedValues

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/tvprovider#1.1.0)

```
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

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/tvprovider#1.1.0)

```
fun toContentValues(): ContentValues!
```

| Returns |
|---|---|
| `https://developer.android.com/reference/android/content/ContentValues.html!` | The fields of the Program in the ContentValues format to be easily inserted into the TV Input Framework database. |

### toString

```
fun toString(): String!
```