List of usage examples for android.media.tv TvContract buildProgramsUriForChannel
public static Uri buildProgramsUriForChannel(Uri channelUri)
From source file:Main.java
public static long getLastProgramEndTimeMillis(ContentResolver resolver, Uri channelUri) { Uri uri = TvContract.buildProgramsUriForChannel(channelUri); String[] projection = { Programs.COLUMN_END_TIME_UTC_MILLIS }; Cursor cursor = null;/* w w w .j a v a2s . co m*/ try { // TvProvider returns programs chronological order by default. cursor = resolver.query(uri, projection, null, null, null); if (cursor == null || cursor.getCount() == 0) { return 0; } cursor.moveToLast(); return cursor.getLong(0); } catch (Exception e) { Log.w(TAG, "Unable to get last program end time for " + channelUri, e); } finally { if (cursor != null) { cursor.close(); } } return 0; }