use of android.support.v4.util.SparseArrayCompat in project SeriesGuide by UweTrottmann.
the class ShowTools method getShowTvdbIdsAndPosters.
/**
* Returns a set of the TVDb ids of all shows in the local database mapped to their poster path
* (null if there is no poster).
*
* @return null if there was an error, empty list if there are no shows.
*/
@Nullable
public static SparseArrayCompat<String> getShowTvdbIdsAndPosters(Context context) {
SparseArrayCompat<String> existingShows = new SparseArrayCompat<>();
Cursor shows = context.getContentResolver().query(SeriesGuideContract.Shows.CONTENT_URI, new String[] { SeriesGuideContract.Shows._ID, SeriesGuideContract.Shows.POSTER }, null, null, null);
if (shows == null) {
return null;
}
while (shows.moveToNext()) {
existingShows.put(shows.getInt(0), shows.getString(1));
}
shows.close();
return existingShows;
}
Aggregations