Example usage for android.media.tv TvContract buildChannelsUriForInput

List of usage examples for android.media.tv TvContract buildChannelsUriForInput

Introduction

In this page you can find the example usage for android.media.tv TvContract buildChannelsUriForInput.

Prototype

public static Uri buildChannelsUriForInput(@Nullable String inputId) 

Source Link

Document

Builds a URI that points to all channels from a given TV input.

Usage

From source file:Main.java

public static int getChannelCount(ContentResolver resolver, String inputId) {
    Uri uri = TvContract.buildChannelsUriForInput(inputId);
    String[] projection = { TvContract.Channels._ID };

    Cursor cursor = null;//from ww  w . j av  a2  s  . c om
    try {
        cursor = resolver.query(uri, projection, null, null, null);
        if (cursor != null) {
            return cursor.getCount();
        }
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }
    return 0;
}

From source file:com.github.mkjensen.dml.live.SetupFragment.java

private static void deleteExistingChannels(ContentResolver resolver, String inputId) {
    int deleted = resolver.delete(TvContract.buildChannelsUriForInput(inputId), null, // where
            null // selectionArgs
    );/*from ww  w .j  a  v  a2  s .  c  om*/
    Log.d(TAG, "Deleted existing channels: " + deleted);
}