Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.

PreviewProgram

class PreviewProgram : BasePreviewProgram
androidx.tvprovider.media.tv.PreviewProgram

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

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

Usage example when inserting a preview program:

PreviewProgram previewProgram = new PreviewProgram.Builder()
          .setChannelId(channel.getId())
          .setType(PreviewPrograms.TYPE_MOVIE)
          .setTitle("Program Title")
          .setDescription("Program Description")
          .setPosterArtUri(Uri.parse("http://example.com/poster_art.png"))
          // Set more attributes...
          .build();
  Uri previewProgramUri = getContentResolver().insert(PreviewPrograms.CONTENT_URI,
          previewProgram.toContentValues());
  

Usage example when retrieving a preview program:

PreviewProgram previewProgram;
  try (Cursor cursor = resolver.query(previewProgramUri, null, null, null, null)) {
      if (cursor != null && cursor.getCount() != 0) {
          cursor.moveToNext();
          previewProgram = PreviewProgram.fromCursor(cursor);
      }
  }
  

Usage example when updating an existing preview program:

PreviewProgram updatedProgram = new PreviewProgram.Builder(previewProgram)
          .setWeight(20)
          .build();
  getContentResolver().update(TvContractCompat.buildPreviewProgramUri(updatedProgram.getId()),
          updatedProgram.toContentValues(), null, null);
  

Usage example when deleting a preview program:

getContentResolver().delete(TvContractCompat.buildPreviewProgramUri(existingProgram.getId()),
          null, null);
  

Summary

Nested classes

This Builder class simplifies the creation of a PreviewProgram object.

Public methods
Boolean
equals(other: Any?)

static PreviewProgram!
fromCursor(cursor: Cursor!)

Creates a Program object from a cursor including the fields defined in PreviewPrograms.

Long

Int

Boolean

Indicates whether some other PreviewProgram has any set attribute that is different from this PreviewProgram's respective attributes.

ContentValues!

String

Public methods

equals

fun equals(other: Any?): Boolean

fromCursor

static fun fromCursor(cursor: Cursor!): PreviewProgram!

Creates a Program object from a cursor including the fields defined in PreviewPrograms.

Parameters
cursor Cursor!: A row from the TV Input Framework database.
Return
PreviewProgram! A Program with the values taken from the cursor.

getChannelId

fun getChannelId(): Long
Return
Long The value of PreviewPrograms#COLUMN_CHANNEL_ID for the program.

getWeight

fun getWeight(): Int
Return
Int The value of PreviewPrograms#COLUMN_WEIGHT for the program.

hasAnyUpdatedValues

fun hasAnyUpdatedValues(update: PreviewProgram!): Boolean

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

toContentValues

fun toContentValues(): ContentValues!
Return
ContentValues! The fields of the Program in the ContentValues format to be easily inserted into the TV Input Framework database.

toString

fun toString(): String