added in version 1.0.0
belongs to Maven artifact androidx.tvprovider:tvprovider:1.0.0-beta01

Channel

public final class Channel
extends Object

java.lang.Object
   ↳ androidx.tvprovider.media.tv.Channel


A convenience class to access TvContractCompat.Channels entries in the system content provider.

This class makes it easy to insert or retrieve a channel from the system content provider, which is defined in TvContractCompat.

Usage example when inserting a channel:

 Channel channel = new Channel.Builder()
         .setDisplayName("Channel Name")
         .setDescription("Channel description")
         .setType(Channels.TYPE_PREVIEW)
         // Set more attributes...
         .build();
 Uri channelUri = getContentResolver().insert(Channels.CONTENT_URI, channel.toContentValues());
 

Usage example when retrieving a channel:

 Channel channel;
 try (Cursor cursor = resolver.query(channelUri, null, null, null, null)) {
     if (cursor != null && cursor.getCount() != 0) {
         cursor.moveToNext();
         channel = Channel.fromCursor(cursor);
     }
 }
 

Usage example when updating an existing channel:

 Channel updatedChannel = new Channel.Builder(channel)
         .setDescription("New channel description")
         .build();
 getContentResolver().update(TvContractCompat.buildChannelUri(updatedChannel.getId()),
         updatedChannel.toContentValues(), null, null);
 

Usage example when deleting a channel:

 getContentResolver().delete(
         TvContractCompat.buildChannelUri(existingChannel.getId()), null, null);
 

Summary

Nested classes

class Channel.Builder

The builder class that makes it easy to chain setters to create a Channel object. 

Public methods

boolean equals(Object other)
static Channel fromCursor(Cursor cursor)

Creates a Channel object from a cursor including the fields defined in TvContractCompat.Channels.

int getAppLinkColor()
Uri getAppLinkIconUri()
Intent getAppLinkIntent()
Uri getAppLinkIntentUri()
Uri getAppLinkPosterArtUri()
String getAppLinkText()
int getConfigurationDisplayOrder()
String getDescription()
String getDisplayName()
String getDisplayNumber()
long getId()
String getInputId()
byte[] getInternalProviderDataByteArray()
Long getInternalProviderFlag1()
Long getInternalProviderFlag2()
Long getInternalProviderFlag3()
Long getInternalProviderFlag4()
String getInternalProviderId()
String getNetworkAffiliation()
int getOriginalNetworkId()
String getPackageName()
int getServiceId()
String getServiceType()
String getSystemChannelKey()
int getTransportStreamId()
String getType()
String getVideoFormat()
int hashCode()
boolean isBrowsable()
boolean isLocked()
boolean isSearchable()
boolean isTransient()
ContentValues toContentValues()
String toString()

Inherited methods

Public methods

equals

public boolean equals (Object other)

Parameters
other Object

Returns
boolean

fromCursor

added in version 1.0.0
public static Channel fromCursor (Cursor cursor)

Creates a Channel object from a cursor including the fields defined in TvContractCompat.Channels.

Parameters
cursor Cursor: A row from the TV Input Framework database.

Returns
Channel A channel with the values taken from the cursor.

getAppLinkColor

added in version 1.0.0
public int getAppLinkColor ()

Returns
int The value of TvContractCompat.Channels.COLUMN_APP_LINK_COLOR for the channel.

getAppLinkIconUri

added in version 1.0.0
public Uri getAppLinkIconUri ()

Returns
Uri The value of TvContractCompat.Channels.COLUMN_APP_LINK_ICON_URI for the channel.

getAppLinkIntent

added in version 1.0.0
public Intent getAppLinkIntent ()

Returns
Intent The value of TvContractCompat.Channels.COLUMN_APP_LINK_INTENT_URI for the program.

Throws
URISyntaxException

getAppLinkIntentUri

added in version 1.0.0
public Uri getAppLinkIntentUri ()

Returns
Uri The value of TvContractCompat.Channels.COLUMN_APP_LINK_INTENT_URI for the channel.

getAppLinkPosterArtUri

added in version 1.0.0
public Uri getAppLinkPosterArtUri ()

Returns
Uri The value of TvContractCompat.Channels.COLUMN_APP_LINK_POSTER_ART_URI for the channel.

getAppLinkText

added in version 1.0.0
public String getAppLinkText ()

Returns
String The value of TvContractCompat.Channels.COLUMN_APP_LINK_TEXT for the channel.

getConfigurationDisplayOrder

added in version 1.0.0
public int getConfigurationDisplayOrder ()

Returns
int The value of TvContractCompat.Channels.COLUMN_CONFIGURATION_DISPLAY_ORDER for the channel.

getDescription

added in version 1.0.0
public String getDescription ()

Returns
String The value of TvContractCompat.Channels.COLUMN_DESCRIPTION for the channel.

getDisplayName

added in version 1.0.0
public String getDisplayName ()

Returns
String The value of TvContractCompat.Channels.COLUMN_DISPLAY_NAME for the channel.

getDisplayNumber

added in version 1.0.0
public String getDisplayNumber ()

Returns
String The value of TvContractCompat.Channels.COLUMN_DISPLAY_NUMBER for the channel.

getId

added in version 1.0.0
public long getId ()

Returns
long The value of BaseColumns._ID for the channel.

getInputId

added in version 1.0.0
public String getInputId ()

Returns
String The value of TvContractCompat.Channels.COLUMN_INPUT_ID for the channel.

getInternalProviderDataByteArray

added in version 1.0.0
public byte[] getInternalProviderDataByteArray ()

Returns
byte[] The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_DATA for the channel.

getInternalProviderFlag1

added in version 1.0.0
public Long getInternalProviderFlag1 ()

Returns
Long The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_FLAG1 for the channel.

getInternalProviderFlag2

added in version 1.0.0
public Long getInternalProviderFlag2 ()

Returns
Long The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_FLAG2 for the channel.

getInternalProviderFlag3

added in version 1.0.0
public Long getInternalProviderFlag3 ()

Returns
Long The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_FLAG3 for the channel.

getInternalProviderFlag4

added in version 1.0.0
public Long getInternalProviderFlag4 ()

Returns
Long The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_FLAG4 for the channel.

getInternalProviderId

added in version 1.0.0
public String getInternalProviderId ()

Returns
String The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_ID for the channel.

getNetworkAffiliation

added in version 1.0.0
public String getNetworkAffiliation ()

Returns
String The value of TvContractCompat.Channels.COLUMN_NETWORK_AFFILIATION for the channel.

getOriginalNetworkId

added in version 1.0.0
public int getOriginalNetworkId ()

Returns
int The value of TvContractCompat.Channels.COLUMN_ORIGINAL_NETWORK_ID for the channel.

getPackageName

added in version 1.0.0
public String getPackageName ()

Returns
String The value of TvContractCompat.BaseTvColumns.COLUMN_PACKAGE_NAME for the channel.

getServiceId

added in version 1.0.0
public int getServiceId ()

Returns
int The value of TvContractCompat.Channels.COLUMN_SERVICE_ID for the channel.

getSystemChannelKey

added in version 1.0.0
public String getSystemChannelKey ()

Returns
String The value of TvContractCompat.Channels.COLUMN_SYSTEM_CHANNEL_KEY for the channel.

getTransportStreamId

added in version 1.0.0
public int getTransportStreamId ()

Returns
int The value of TvContractCompat.Channels.COLUMN_TRANSPORT_STREAM_ID for the channel.

getType

added in version 1.0.0
public String getType ()

Returns
String The value of TvContractCompat.Channels.COLUMN_TYPE for the channel.

getVideoFormat

added in version 1.0.0
public String getVideoFormat ()

Returns
String The value of TvContractCompat.Channels.COLUMN_VIDEO_FORMAT for the channel.

hashCode

public int hashCode ()

Returns
int

isBrowsable

added in version 1.0.0
public boolean isBrowsable ()

Returns
boolean The value of TvContractCompat.Channels.COLUMN_BROWSABLE for the channel.

isLocked

added in version 1.0.0
public boolean isLocked ()

Returns
boolean The value of TvContractCompat.Channels.COLUMN_LOCKED for the channel.

isSearchable

added in version 1.0.0
public boolean isSearchable ()

Returns
boolean The value of TvContractCompat.Channels.COLUMN_SEARCHABLE for the channel.

isTransient

added in version 1.0.0
public boolean isTransient ()

Returns
boolean The value of TvContractCompat.Channels.COLUMN_TRANSIENT for the channel.

toContentValues

added in version 1.0.0
public ContentValues toContentValues ()

Returns
ContentValues The fields of the Channel in the ContentValues format to be easily inserted into the TV Input Framework database.

toString

public String toString ()

Returns
String