Program
public
final
class
Program
extends Object
implements
Comparable<Program>
java.lang.Object
|
↳ |
androidx.tvprovider.media.tv.Program
|
A convenience class to access TvContractCompat.Programs
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 TvContractCompat
.
Usage example when inserting a program:
Program program = new Program.Builder()
.setChannelId(channel.getId())
.setTitle("Program Title")
.setDescription("Program Description")
.setPosterArtUri(Uri.parse("http://example.com/poster_art.png"))
// Set more attributes...
.build();
Uri programUri = getContentResolver().insert(Programs.CONTENT_URI, program.toContentValues());
Usage example when retrieving a program:
Program program;
try (Cursor cursor = resolver.query(programUri, null, null, null, null)) {
if (cursor != null && cursor.getCount() != 0) {
cursor.moveToNext();
program = Program.fromCursor(cursor);
}
}
Usage example when updating an existing program:
Program updatedProgram = new Program.Builder(program)
.setEndTimeUtcMillis(newProgramEndTime)
.build();
getContentResolver().update(TvContractCompat.buildProgramUri(updatedProgram.getId()),
updatedProgram.toContentValues(), null, null);
Usage example when deleting a program:
getContentResolver().delete(TvContractCompat.buildProgramUri(existingProgram.getId()),
null, null);
Summary
Nested classes |
class |
Program.Builder
This Builder class simplifies the creation of a Program object.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
From interface
java.lang.Comparable
abstract
int
|
compareTo(Program arg0)
|
|
Public methods
public int compareTo (Program other)
Parameters |
other |
Program : The program you're comparing to. |
Returns |
int |
The chronological order of the programs.
|
equals
public boolean equals (Object other)
fromCursor
public static Program fromCursor (Cursor cursor)
Creates a Program object from a cursor including the fields defined in TvContractCompat.Programs
.
Parameters |
cursor |
Cursor : A row from the TV Input Framework database. |
Returns |
Program |
A Program with the values taken from the cursor.
|
getAudioLanguages
public String[] getAudioLanguages ()
Returns |
String[] |
The audio languages for the program. |
getBroadcastGenres
public String[] getBroadcastGenres ()
getCanonicalGenres
public String[] getCanonicalGenres ()
Returns |
String[] |
The canonical genre for the program. |
getChannelId
public long getChannelId ()
getDescription
public String getDescription ()
Returns |
String |
The short description for the program. |
getEndTimeUtcMillis
public long getEndTimeUtcMillis ()
getEpisodeNumber
public String getEpisodeNumber ()
Returns |
String |
The episode display number for the program. |
getEpisodeTitle
public String getEpisodeTitle ()
Returns |
String |
The episode title for the program. |
getId
public long getId ()
Returns |
long |
The ID for the program. |
getInternalProviderDataByteArray
public byte[] getInternalProviderDataByteArray ()
Returns |
byte[] |
The internal provider data for the program. |
getInternalProviderFlag1
public Long getInternalProviderFlag1 ()
Returns |
Long |
The first internal provider flag for the program. |
getInternalProviderFlag2
public Long getInternalProviderFlag2 ()
Returns |
Long |
The second internal provider flag for the program. |
getInternalProviderFlag3
public Long getInternalProviderFlag3 ()
Returns |
Long |
The third internal provider flag for the program. |
getInternalProviderFlag4
public Long getInternalProviderFlag4 ()
Returns |
Long |
The forth internal provider flag for the program. |
getLongDescription
public String getLongDescription ()
Returns |
String |
The long description for the program. |
getPosterArtUri
public Uri getPosterArtUri ()
Returns |
Uri |
The poster art URI for the program. |
getReviewRating
public String getReviewRating ()
Returns |
String |
The review rating for the program. |
getReviewRatingStyle
public int getReviewRatingStyle ()
Returns |
int |
The review rating style for the program. |
getSeasonNumber
public String getSeasonNumber ()
Returns |
String |
The season display number for the program. |
getSeasonTitle
public String getSeasonTitle ()
Returns |
String |
The season title for the program. |
getSeriesId
public String getSeriesId ()
Returns |
String |
The series ID for the program. |
getStartTimeUtcMillis
public long getStartTimeUtcMillis ()
getThumbnailUri
public Uri getThumbnailUri ()
Returns |
Uri |
The thumbnail URI for the program. |
getTitle
public String getTitle ()
Returns |
String |
The title for the program. |
getVideoHeight
public int getVideoHeight ()
Returns |
int |
The video height for the program. |
getVideoWidth
public int getVideoWidth ()
Returns |
int |
The video width for the program. |
hashCode
public int hashCode ()
isRecordingProhibited
public boolean isRecordingProhibited ()
isSearchable
public boolean isSearchable ()
Returns |
boolean |
Whether the program is searchable or not. |
toContentValues
public ContentValues toContentValues ()
Returns |
ContentValues |
The fields of the Program in the ContentValues format to be easily inserted into the
TV Input Framework database.
|
toString
public String toString ()
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-30 UTC.