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()
String getGlobalContentId()
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