# PreviewChannel

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/PreviewChannel.java+class:androidx.tvprovider.media.tv.PreviewChannel) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/tvprovider#1.1.0)

*** ** * ** ***


```
public class PreviewChannel
```

<br />

*** ** * ** ***

Since API 26, all TV apps may create preview channels and publish them to the home screen. We call these App Channels (as distinct from the Live Channels row on the home screen). To help you create App Channels, the support library provides a number of classes prefixed by the word Preview-. This is a convenience class for mapping your app's content into a `https://developer.android.com/reference/androidx/tvprovider/media/tv/TvContractCompat` for publication. Use the provided `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel.Builder` for creating your preview channel object. Once you create a preview channel, you can use `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannelHelper` to publish it and add `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewProgram` to it.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel.Builder` This builder makes it easy to create a PreviewChannel object by allowing you to chain setters. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#fromCursor(android.database.Cursor)(https://developer.android.com/reference/android/database/Cursor.html cursor)` Used by `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannelHelper` to transduce a TvProvider channel row into a PreviewChannel Java object. |
| `https://developer.android.com/reference/android/content/Intent.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getAppLinkIntent()()` |
| `https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getAppLinkIntentUri()()` |
| `https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getDescription()()` |
| `https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getDisplayName()()` |
| `long` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getId()()` |
| `byte[]` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getInternalProviderDataByteArray()()` |
| `https://developer.android.com/reference/java/lang/Long.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getInternalProviderFlag1()()` |
| `https://developer.android.com/reference/java/lang/Long.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getInternalProviderFlag2()()` |
| `https://developer.android.com/reference/java/lang/Long.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getInternalProviderFlag3()()` |
| `https://developer.android.com/reference/java/lang/Long.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getInternalProviderFlag4()()` |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getInternalProviderId()()` |
| `https://developer.android.com/reference/android/graphics/Bitmap.html` | `@https://developer.android.com/reference/androidx/annotation/WorkerThread https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getLogo(android.content.Context)(https://developer.android.com/reference/android/content/Context.html context)` This method should be called on a worker thread since decoding Bitmap is an expensive operation and therefore should not be performed on the main thread. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getPackageName()()` |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#getType()()` |
| `boolean` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#hasAnyUpdatedValues(androidx.tvprovider.media.tv.PreviewChannel)(https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel update)` Indicates whether some other PreviewChannel has any set attribute that is different from this PreviewChannel's respective attributes. |
| `int` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#hashCode()()` |
| `boolean` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#isBrowsable()()` |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel#toString()()` |

## Public methods

### equals

```
public boolean equals(Object other)
```

### fromCursor

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

```
public static @Nullable PreviewChannel fromCursor(Cursor cursor)
```

Used by `https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannelHelper` to transduce a TvProvider channel row into a PreviewChannel Java object. You never need to use this method unless you want to convert database rows to PreviewChannel objects yourself.
This method assumes the cursor was obtained using `https://developer.android.com/reference/androidx/tvprovider/media/tv/package-summary`. This way, all indices are known beforehand.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/database/Cursor.html cursor` | a cursor row from the TvProvider |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/tvprovider/media/tv/PreviewChannel` | a PreviewChannel whose values come from the cursor row or `null` if the cursor is not pointing at a preview channel. |

### getAppLinkIntent

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

```
public Intent getAppLinkIntent()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/android/content/Intent.html` | The value of `https://developer.android.com/reference/androidx/tvprovider/media/tv/TvContractCompat.Channels#COLUMN_APP_LINK_INTENT_URI()` for the program. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/net/URISyntaxException.html` |   |

### getAppLinkIntentUri

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

```
public Uri getAppLinkIntentUri()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/android/net/Uri.html` | The value of `https://developer.android.com/reference/androidx/tvprovider/media/tv/TvContractCompat.Channels#COLUMN_APP_LINK_INTENT_URI()` for the channel. |

### getDescription

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

```
public CharSequence getDescription()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence.html` | The value of `https://developer.android.com/reference/androidx/tvprovider/media/tv/TvContractCompat.Channels#COLUMN_DESCRIPTION()` for the channel. A short text explaining what this channel contains. |

### getDisplayName

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

```
public CharSequence getDisplayName()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence.html` | The name users see when this channel appears on the home screen |

### getId

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

```
public long getId()
```

| Returns |
|---|---|
| `long` | the ID the system assigns to this preview channel upon publication. |

### getInternalProviderDataByteArray

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

```
public byte[] getInternalProviderDataByteArray()
```

| Returns |
|---|---|
| `byte[]` | The value of `https://developer.android.com/reference/androidx/tvprovider/media/tv/TvContractCompat.Channels#COLUMN_INTERNAL_PROVIDER_DATA()` for the channel. |

### getInternalProviderFlag1

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

```
public Long getInternalProviderFlag1()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/Long.html` | The value of `https://developer.android.com/reference/androidx/tvprovider/media/tv/TvContractCompat.Channels#COLUMN_INTERNAL_PROVIDER_FLAG1()` for the channel. |

### getInternalProviderFlag2

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

```
public Long getInternalProviderFlag2()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/Long.html` | The value of `https://developer.android.com/reference/androidx/tvprovider/media/tv/TvContractCompat.Channels#COLUMN_INTERNAL_PROVIDER_FLAG2()` for the channel. |

### getInternalProviderFlag3

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

```
public Long getInternalProviderFlag3()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/Long.html` | The value of `https://developer.android.com/reference/androidx/tvprovider/media/tv/TvContractCompat.Channels#COLUMN_INTERNAL_PROVIDER_FLAG3()` for the channel. |

### getInternalProviderFlag4

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

```
public Long getInternalProviderFlag4()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/Long.html` | The value of `https://developer.android.com/reference/androidx/tvprovider/media/tv/TvContractCompat.Channels#COLUMN_INTERNAL_PROVIDER_FLAG4()` for the channel. |

### getInternalProviderId

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

```
public String getInternalProviderId()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | The value of `https://developer.android.com/reference/androidx/tvprovider/media/tv/TvContractCompat.Channels#COLUMN_INTERNAL_PROVIDER_ID()` for the channel. |

### getLogo

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

```
@WorkerThread
public Bitmap getLogo(Context context)
```

This method should be called on a worker thread since decoding Bitmap is an expensive operation and therefore should not be performed on the main thread.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/graphics/Bitmap.html` | The logo associated with this preview channel |

### getPackageName

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

```
public String getPackageName()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | package name of the app that created this channel |

### getType

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

```
public String getType()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | what type of channel this is. For preview channels, the type is always TvContractCompat.Channels.TYPE_PREVIEW |

### hasAnyUpdatedValues

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

```
public boolean hasAnyUpdatedValues(PreviewChannel update)
```

Indicates whether some other PreviewChannel has any set attribute that is different from this PreviewChannel's respective attributes. An attribute is considered "set" if its key is present in the ContentValues vector.

### hashCode

```
public int hashCode()
```

### isBrowsable

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

```
public boolean isBrowsable()
```

| Returns |
|---|---|
| `boolean` | The value of `https://developer.android.com/reference/androidx/tvprovider/media/tv/TvContractCompat.Channels#COLUMN_BROWSABLE()` for the channel. A preview channel is BROWABLE when it is visible on the TV home screen. |

### toString

```
public String toString()
```