Channel
public final class 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 types |
|---|
public final class Channel.BuilderThe builder class that makes it easy to chain setters to create a |
Public methods |
|
|---|---|
boolean |
|
static Channel |
fromCursor(Cursor cursor)Creates a Channel object from a cursor including the fields defined in |
int |
|
Uri |
|
Intent |
|
Uri |
|
Uri |
|
String |
|
int |
|
String |
|
String |
|
String |
|
@Nullable String |
|
long |
getId() |
String |
|
byte[] |
|
Long |
|
Long |
|
Long |
|
Long |
|
String |
|
String |
|
int |
|
String |
|
int |
|
String |
|
String |
|
int |
|
String |
getType() |
String |
|
int |
hashCode() |
boolean |
|
boolean |
isLocked() |
boolean |
|
boolean |
|
ContentValues |
|
String |
toString() |
Public methods
fromCursor
public static Channel fromCursor(Cursor cursor)
Creates a Channel object from a cursor including the fields defined in Channels.
| Parameters | |
|---|---|
Cursor cursor |
A row from the TV Input Framework database. |
| Returns | |
|---|---|
Channel |
A channel with the values taken from the cursor. |
getAppLinkColor
public int getAppLinkColor()
| Returns | |
|---|---|
int |
The value of |
getAppLinkIconUri
public Uri getAppLinkIconUri()
| Returns | |
|---|---|
Uri |
The value of |
getAppLinkIntent
public Intent getAppLinkIntent()
| Returns | |
|---|---|
Intent |
The value of |
| Throws | |
|---|---|
java.net.URISyntaxException |
getAppLinkIntentUri
public Uri getAppLinkIntentUri()
| Returns | |
|---|---|
Uri |
The value of |
getAppLinkPosterArtUri
public Uri getAppLinkPosterArtUri()
| Returns | |
|---|---|
Uri |
The value of |
getAppLinkText
public String getAppLinkText()
| Returns | |
|---|---|
String |
The value of |
getConfigurationDisplayOrder
public int getConfigurationDisplayOrder()
| Returns | |
|---|---|
int |
The value of |
getDescription
public String getDescription()
| Returns | |
|---|---|
String |
The value of |
getDisplayName
public String getDisplayName()
| Returns | |
|---|---|
String |
The value of |
getDisplayNumber
public String getDisplayNumber()
| Returns | |
|---|---|
String |
The value of |
getGlobalContentId
public @Nullable String getGlobalContentId()
| Returns | |
|---|---|
@Nullable String |
The value of |
getInputId
public String getInputId()
| Returns | |
|---|---|
String |
The value of |
getInternalProviderDataByteArray
public byte[] getInternalProviderDataByteArray()
| Returns | |
|---|---|
byte[] |
The value of |
getInternalProviderFlag1
public Long getInternalProviderFlag1()
| Returns | |
|---|---|
Long |
The value of |
getInternalProviderFlag2
public Long getInternalProviderFlag2()
| Returns | |
|---|---|
Long |
The value of |
getInternalProviderFlag3
public Long getInternalProviderFlag3()
| Returns | |
|---|---|
Long |
The value of |
getInternalProviderFlag4
public Long getInternalProviderFlag4()
| Returns | |
|---|---|
Long |
The value of |
getInternalProviderId
public String getInternalProviderId()
| Returns | |
|---|---|
String |
The value of |
getNetworkAffiliation
public String getNetworkAffiliation()
| Returns | |
|---|---|
String |
The value of |
getOriginalNetworkId
public int getOriginalNetworkId()
| Returns | |
|---|---|
int |
The value of |
getPackageName
public String getPackageName()
| Returns | |
|---|---|
String |
The value of |
getServiceId
public int getServiceId()
| Returns | |
|---|---|
int |
The value of |
getServiceType
public String getServiceType()
| Returns | |
|---|---|
String |
The value of Returns |
getSystemChannelKey
public String getSystemChannelKey()
| Returns | |
|---|---|
String |
The value of |
getTransportStreamId
public int getTransportStreamId()
| Returns | |
|---|---|
int |
The value of |
getType
public String getType()
| Returns | |
|---|---|
String |
The value of |
getVideoFormat
public String getVideoFormat()
| Returns | |
|---|---|
String |
The value of |
isBrowsable
public boolean isBrowsable()
| Returns | |
|---|---|
boolean |
The value of |
isLocked
public boolean isLocked()
| Returns | |
|---|---|
boolean |
The value of |
isSearchable
public boolean isSearchable()
| Returns | |
|---|---|
boolean |
The value of |
isTransient
public boolean isTransient()
| Returns | |
|---|---|
boolean |
The value of |
toContentValues
public ContentValues toContentValues()
| Returns | |
|---|---|
ContentValues |
The fields of the Channel in the ContentValues format to be easily inserted into the TV Input Framework database. |